我正在寻找一个脚本或者一些东西,这将允许我检查AD中所有用户的操作系统版本,而不会中断日常操作。 到目前为止,我发现这个脚本可以find操作系统信息, http://www.windowsadminscripts.com/coding/networking/osinfo/ 。
但是,我不知道如何将这个脚本应用到AD中的所有用户。 有什么build议?
你可以通过使用PowerShell命令来实现这个目标。 打开PowerShell cmd窗口并input以下命令:
Get-ADComputer -Filter * -Property * | Format-Table Name,OperatingSystem,OperatingSystemServicePack,OperatingSystemVersion -Wrap –Auto
此命令将筛选所有计算机的所有属性。 然后将输出redirect到一个格式化的表格。
该表包含的唯一属性是计算机名称,操作系统说明,服务包和操作系统版本。 它也会自动resize和包装数据。
为了查找域中的所有服务器,运行以下命令:
Get-ADComputer -Filter {OperatingSystem -Like "Windows Server*"} -Property * | Format-Table Name,OperatingSystem,OperatingSystemServicePack -Wrap -Auto
为了find运行Windows Server 2008的所有服务器,运行:
Get-ADComputer -Filter {OperatingSystem -Like "Windows Server*2008*"} -Property * | Format-Table Name,OperatingSystem,OperatingSystemServicePack -Wrap -Auto
为了查找运行Windows Server 2008 R2的所有服务器,运行:
Get-ADComputer -Filter {OperatingSystem -Like "Windows Server*r2*"} -Property * | Format-Table Name,OperatingSystem,OperatingSystemServicePack -Wrap -Auto
我希望这回答了你的问题。
编辑:
为了运行Get-ADComputer
命令,您必须安装“Windows远程服务器pipe理工具”。
请按照本指南进行操作。 然后,在PowerShellterminal中,键入:
import-module activedirectory
然后重新运行Get-ADComputer
命令。
检查以下屏幕截图,您会看到一个错误,因为我第一次运行命令时没有安装PowerShell的Active Directory模块:
假设您指的是您的用户使用的计算机,则此信息已存储在AD中,用于任何join域的PC。 您应该能够脚本从计算机对象: operatingSystem
, operatingSystemServicePack
和operatingSystemVersion
拉动这些属性。
除了上面列出的powershell命令之外,您还可以使用一个名为PowerGUI的基于gui的工具。 这是非常方便的工具,使ActiveDirectorypipe理更容易。 你可以完成你在这个问题等等问题。 在使用gui时,它实际上在后台运行了powershell命令。 您可以查看它运行的脚本。
我也build议查看提供丰富的PowerShell cmdlet的Quest Active Roles 。