Monday, 21 November 2011

PowerShell setup tips

Some notes on first-time setup of PowerShell on a Windows server

The PowerShell ISE is a separate feature, selected via a Win2008 Server Manager -> Features entry

set-executionpolicy unrestricted
for the typical test&dev environment (might want to be more secure in live)
Equivalent in Registry:
HKLM\SOFTWARE\Microsoft\Powershel1\ShellIds\Microsoft.PowerShell
ExecutionPolicy REG_SZ Unrestricted

Setting up the profile (PS startup script)
new-item -type file -force $profile
notepad $profile
Running it immediately:
. $profile
Viewing it:
get-childitem $profile

Profile segment for Quest AD module:
Add-PSSnapin Quest.ActiveRoles.ADManagement
Profile segment for Exchange 2010:
Add-PSSnapin Microsoft.Exchange.Management.PowerShell.E2010
. $env:ExchangeInstallPath\bin\RemoteExchange.ps1
Connect-ExchangeServer -auto

No comments:

Followers