Introduction - Spiceworks



IntroductionPowerShell is Microsoft’s command line and scripting tool that dramatically extends and easily replaces both cmd.exe and vBscript. It’s actually a part of the Windows Management Framework, which includes the newest implementations of Windows Remote Management (WinRM) and Windows Management Instrumentation (WMI). The current release is version 4.0 (). Windows 7 (and Windows Server 2008) come pre-installed with version 2.0. In Exchange 2007 and 2010 both the management shell and the management GUI are written in PowerShell 2.0. It’s critically important NOT to install newer versions of PowerShell on these servers. Although upgrading your Windows 7.1 workstation or laptop to version 4.0 is highly recommended.In fact, it’s best not to change the version of PowerShell on any server. Instead, it’s much better to set the server up for remote administration. There are no conflicts or issues between PowerShell versions over the remoting interface. WinRM, once set up, pretty much replaces the need for RDP connection to a server. It does take a one-time setup, though, to make WinRM active: Invoke PowerShell as Administrator on the server (START\Accessories\WindowsPowerShell\WindowsPowerShell or START\Accessories\WindowsPowerShell\WindowsPowerShell ISE [ISE is the Interactive Scripting Environment for script writing]). At the prompt, enterSet-ExecutionPolicy RemoteSignedEnable-PSRemoting Respond with “Y” to any queries. The execution policy allows local scripts to be run, but requires any remote scripts to run only if they have a valid signing certificate attached. PSRemoting sets up an encrypted (via port 443) link to the PowerShell remoting interface on the server designed to eliminate any firewall issues.Learning PowerShellThere are lots of PowerShell training materials available. One of the most popular is PowerShell in a Month of Lunches () that focuses on version 3, but version 4 includes all of that unchanged. The web site includes a wealth of material, including a free eBook (). And there’s an enormous amount of useful material at the Microsoft Scripting Guys blog (). The simplest part of PowerShell is the format of a command line: <verb>-<noun> <parameters>. There are a lot of built-in verbs, such as Add, Get, Set, New, and an almost unlimited number of nouns. The two most important commands to begin with are Get-Command and Get-Help. For example, try these:Get-Command *help*Get-Help about* | Select NamePowerShell and Active DirectoryThe easiest way to manage AD through PowerShell is to install RSAT on a Windows 7.1 workstation () and configure the AD PowerShell component. In PowerShell versions 2 and 3, you will need to enter the commandImport-Module ActiveDirectory The import happens automatically in version 4 when you enter any command from the module. Most of the AD command nouns begin with “AD”, so you can get list of them quite easily with Get-Command *AD* or you can use get-command -Module ActiveDirectory.PowerShell and ExchangeIn Exchange 2007 and 2010, both the Exchange Management Shell and the Exchange Management Console have been written in PowerShell version 2 remoting (Installing a newer version of PowerShell on those servers will crash Exchange and make it unusable, so NEVER update the version of PowerShell on Exchange servers). Yep, even if you invoke Exchange management on the server, it will connect using remoting. So, using remoting with Exchange is no big problem. In fact, the easiest way to remote control Exchange is to import the remote Exchange module into your current PowerShell session (this is called “implicit remoting”). Here’s how:$EXCC = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri -Authentication KerberosImport-PSSession $EXCC -AllowClobberWhen finished working with Exchange, you can disconnect from the server by either exiting the PowerShell session or by entering this command:Remove-PSSession $EXCC ................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download