Tuesday, May 1, 2012

Powershell and Active Directory: Find all windows 7 computers with Service Pack 1 installed using PowerShell.

 

Hi,

In Our company we have "Domain Environment" or we can say "Active Directory" is deployed.  By using "Active Directory" lots of things gets easy to manage. The main things that Powershell works great with "Active Directory". To use Active Directory related CMDLETS on your client laptopt we  need to install "RSAT" tool.

Problem: On some of our company laptop there are "Automatic Updates" are on, due to these auto updates Windows 7 Service Pack 1 is installed on those laptops, and Windows 7 SP1 is not compatible with some of our in-house developed software. So we need to identify these laptops.

Let's Start : Before doing anything make sure that "RSAT" tools are installed.

Import the Active Directory module first.

Import-Module ActiveDirectory

30-04-2012 23-21-03 

After importing the Module, we are going to use Get-ADComputer cmdlet.

To view all the computer on AD we can use the below cmdlet.

Get-ADComputer -Filter *

01-05-2012 12-07-05

Lets filter it more . .. this time we want to see only those computers which have windows 7 installed.

Get-ADComputer -Filter 'OperatingSystem -eq "Windows 7 Professional"'  | select Name

Ok. now it is showing all those computers which have windows 7 installed.. let filter it more.

01-05-2012 12-09-59

As we know our main purpose is to find the "Windows 7 Computers with Service Pack 1" Installed.

Get-ADComputer -Filter '(OperatingSystem -eq "Windows 7 Professional") -and (OperatingSystemServicePack  -eq "ServicePack1")'

So finally we have the list of all windows 7 computers with SP-1 installed on them.

01-05-2012 12-43-08

Let just select Name Only.

Get-ADComputer -Filter '(OperatingSystem -eq "Windows 7 Professional") -and (OperatingSystemServicePack  -eq "Service Pack 1")' | select Name

01-05-2012 12-55-57

All sorted., Now i have the list of my all windows 7 computers which have Service Pack 1 installed on it.

Thanks

Aman Dhally

1 comment:

  1. This comment has been removed by a blog administrator.

    ReplyDelete