0

I'm looking to make a script or something along those lines which will allow me to check the OS version of all users within the AD, without interrupting daily operations. So far i've found this script which finds OS information, http://www.windowsadminscripts.com/coding/networking/osinfo/.

But, I have no idea on how to apply this script to all users in the AD. Any advice?

user2670669
  • 13
  • 1
  • 4

3 Answers3

2

You can achieve this goal by using a PowerShell command. Open up a PowerShell cmd window and enter the following command:

Get-ADComputer -Filter * -Property * | Format-Table Name,OperatingSystem,OperatingSystemServicePack,OperatingSystemVersion -Wrap –Auto

This command is filtering all computers for all their properties. It then redirects the output into a formatted table.

The only attributes that the table contains are the computer name, operating system description, service pack, and OS version. It also automatically sizes and wraps the data.

In order to find all servers in the domain, run the following command:

Get-ADComputer -Filter {OperatingSystem -Like "Windows Server*"} -Property * | Format-Table Name,OperatingSystem,OperatingSystemServicePack -Wrap -Auto

In order to find all servers running Windows Server 2008, run:

Get-ADComputer -Filter {OperatingSystem -Like "Windows Server*2008*"} -Property * | Format-Table Name,OperatingSystem,OperatingSystemServicePack -Wrap -Auto

In order to find all servers running Windows Server 2008 R2, run:

Get-ADComputer -Filter {OperatingSystem -Like "Windows Server*r2*"} -Property * | Format-Table Name,OperatingSystem,OperatingSystemServicePack -Wrap -Auto

I hope this answers your question.

Edit:

In order to run the Get-ADComputer command, you will have to install "Remote Server Administration Tools for Windows".

Follow This guide in order to do so. Then, while in a PowerShell Terminal, type:

import-module activedirectory

And then re-run the Get-ADComputer command.

Check the following screenshot, you see an error there because the first time I ran the command I didn't have the Active Directory module for PowerShell installed: enter image description here

Itai Ganot
  • 10,644
  • 29
  • 93
  • 146
0

Assuming you're referring to the Computers your users use, then this information is already stored in AD for any Domain Joined PC. You should be able to script pulling these attributes from the Computer Objects: operatingSystem, operatingSystemServicePack, & operatingSystemVersion.

HostBits
  • 11,796
  • 1
  • 25
  • 39
0

In addition to the powershell commands posted above, you can also use a gui based tool called PowerGUI. This is pretty handy tool to have which makes ActiveDirectory management a lot easier. You can accomplish what you are asking in this question and much more. While you are using the gui, it actually runs powershell commands in the background. You can view the scripts that it runs.

I would also recommend checking out Quest Active Roles which provide a wealth of powershell cmdlets.