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: http://www.quest.com/powershell/activeroles-server.aspx
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 Test-Path $Profile
Second, run New-Item –path $profile –type file –force to create a blank profile
Then run Notepad $Profile to open up the profile and edit it.
Here is what I use in my $Profile:
# Import Exchange cmdlets
$e = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri http://CasServer.Infrastructurehep.com/powershell
# Import Lync cmdlets
$l = New-PSSessionOption -SkipRevocationCheck -SkipCACheck –SkipCNCheck
$ls = New-PSSession -ConnectionUri https://FEServer.infrastructurehelp.com/ocspowershell -SessionOption $l -Authentication NegotiateWithImplicitCredential
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:
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.