POWERSHELL PROFILE and MODULES |
|
If you haven't set up a profile then every time you open a new session of Powershell or as Don Jones calls it "the Shell", you will have to load whatever modules you want to work with. As a DBA, you want SQLPS loaded. Here is the code you need .
import-module SQLPS -DisableNameChecking
"import-module SQLPS -DisableNameChecking: Done."
Your profile folder is located in
Documents --> WindowsPowershell
Create your profile and name it Microsoft.Powershell_Profile.ps1
If you want to use Microsoft Powershell ISE then you will need a profile for that as well. ISE stands for Integrated Scripting Environment.
It should be named Microsoft.PowershellISE_Profile.ps1
import-module SQLPS -DisableNameChecking
"import-module SQLPS -DisableNameChecking: Done."
Your profile folder is located in
Documents --> WindowsPowershell
Create your profile and name it Microsoft.Powershell_Profile.ps1
If you want to use Microsoft Powershell ISE then you will need a profile for that as well. ISE stands for Integrated Scripting Environment.
It should be named Microsoft.PowershellISE_Profile.ps1
Where is Powershell ISE!! |
|
If you don't see Powershell ISE on a server you will need to enable it from Server Manager. Pretty straight ahead process, Click on Features and scroll down and click the box for Powershell ISE.
The link below explains the process in more detail.
https://technet.microsoft.com/en-us/magazine/ff476072.aspx
The link below explains the process in more detail.
https://technet.microsoft.com/en-us/magazine/ff476072.aspx
POWERSHELL MODULE LOCATIONS... |
|
I had to do some weird troubleshooting involving powershell modules and their associated paths.
There can me multiple locations where modules can be saved too. Maybe you want a module to only be run by a single user or by all users. Click link below to find that info.
https://msdn.microsoft.com/en-us/library/dd878350(v=vs.85).aspx
There can me multiple locations where modules can be saved too. Maybe you want a module to only be run by a single user or by all users. Click link below to find that info.
https://msdn.microsoft.com/en-us/library/dd878350(v=vs.85).aspx
Install-Module as a different user |
|
We have to use different accounts to access the production environment. I need to install a module but the user that is currently running the powershell session.
Install-module <module name> -scope currentuser
Install-module <module name> -scope currentuser