04.07.2013 Views

Windows PowerShell 3.0 Step by Step - Cdn.oreilly.com - O'Reilly

Windows PowerShell 3.0 Step by Step - Cdn.oreilly.com - O'Reilly

Windows PowerShell 3.0 Step by Step - Cdn.oreilly.com - O'Reilly

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Get-<strong>PowerShell</strong>Requirements.ps1<br />

Param([string[]]$<strong>com</strong>puter = @($env:<strong>com</strong>putername, "LocalHost"))<br />

foreach ($c in $<strong>com</strong>puter)<br />

{<br />

$o = Get-WmiObject win32_operatingsystem -cn $c<br />

switch ($o.version)<br />

{<br />

{$o.version -gt 6.2} {"$c is <strong>Windows</strong> 8 or greater"; break}<br />

{$o.version -gt 6.1}<br />

{<br />

If($o.ServicePackMajorVersion -gt 0){$sp = $true}<br />

If(Get-WmiObject Win32_Product -cn $c |<br />

where { $_.name -match '.NET Framework 4'}) {$net = $true }<br />

If($sp -AND $net) { "$c meets the requirements for <strong>PowerShell</strong> 3" ; break}<br />

ElseIF (!$sp) {"$c needs a service pack"; break}<br />

ELSEIF (!$net) {"$c needs a .NET Framework upgrade"} ; break}<br />

{$o.version -lt 6.1} {"$c does not meet standards for <strong>PowerShell</strong> <strong>3.0</strong>"; break}<br />

Default {"Unable to tell if $c meets the standards for <strong>PowerShell</strong> <strong>3.0</strong>"}<br />

}<br />

}<br />

Deploying <strong>Windows</strong> <strong>PowerShell</strong> to down-level<br />

operating systems<br />

After <strong>Windows</strong> <strong>PowerShell</strong> is downloaded from http://www.microsoft.<strong>com</strong>/downloads, you can deploy<br />

it to your enterprise <strong>by</strong> using any of the standard methods. Here are few of the methods that you can<br />

use to ac<strong>com</strong>plish <strong>Windows</strong> <strong>PowerShell</strong> deployment:<br />

■■ Create a Microsoft Systems Center Configuration Manager package and advertise it to the<br />

appropriate organizational unit (OU) or collection.<br />

■■ Create a Group Policy Object (GPO) in Active Directory Domain Services (AD DS) and link it to<br />

the appropriate OU.<br />

■■ Approve the update in Software Update Services (SUS) when available.<br />

■■ Add the <strong>Windows</strong> Management Framework <strong>3.0</strong> packages to a central file share or webpage<br />

for self service.<br />

If you are not deploying to an entire enterprise, perhaps the easiest way to install <strong>Windows</strong><br />

<strong>PowerShell</strong> is to download the package and step through the wizard.<br />

note To use a <strong>com</strong>mand-line utility in <strong>Windows</strong> <strong>PowerShell</strong>, launch <strong>Windows</strong> <strong>PowerShell</strong><br />

<strong>by</strong> choosing Start | Run | <strong>PowerShell</strong>. At the <strong>PowerShell</strong> prompt, type in the <strong>com</strong>mand<br />

to run.<br />

4 <strong>Windows</strong> <strong>PowerShell</strong> 3 <strong>Step</strong> <strong>by</strong> <strong>Step</strong>

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!