You will find that there are many times you need to run PowerShell scripts or cmdlets from your desktop because you need a combination of modules or you have other needs.
For example, for many of the scripts that I run, I need the Quest Active Directory module that can be downloaded for free from here:
Set Execution Policy You may need to set the script execution policy to run PowerShell scripts from your local console. Run,
Set-ExecutionPolicy Unrestricted and that should work for you.
Configure a PowerShell Profile You will want to configure a profile that will store your configuration on the computer.
First, make sure you don’t already have a profile by running
New-Item –path $profile –type file –force to create a blank profile
Notepad $Profile to open up the profile and edit it. Here is what I use in my $Profile:
# Import Exchange cmdlets
# Import Lync cmdlets
$l = New-PSSessionOption -SkipRevocationCheck -SkipCACheck –SkipCNCheck
Import-PSSession $ls The first line sets the default starting location when PowerShell is started.
The second line is used to import the Active Directory cmdlets.
The third line adds the Quest cmdlets. Of course, this line is worthless unless you have installed the Quest tools, first.
The Exchange section follows. I would use these two lines, instead of the section used above for the lines for remoting, if I have the Exchange admin tools installed on the desktop:
Add-PSSanpin Microsoft.Exchange.Management.PowerShell.Support The Lync section is after the Exchange section. I would also use this line if the Lync tools are installed on the computer:
Run as AD Account Running PowerShell as your standard user account is pretty much worthless. So, you can use the famous Run-As to start up PowerShell using your AD credentials.
Click Start, All Programs, Accessories, Windows PowerShell, then right-click the Windows PowerShell icon and select Properties.
In Properties, in the Target attribute, modify it like my example with everything on one line:
C:\Windows\System32\runas.exe /user:us\ad.russ ”%SystemRoot%\syswow64\WindowsPowerShell\v1.0\powershell.exe” You might want to pin the icon to your Start Menu or create a short-cut. I find it so much easier that way.
This entry was posted in
. Bookmark the