[Powershell]导出域内主机信息

在域控制器上启动Active Directory Module for Windows PowerShell 执行如下命令获取主机信息。

导出域内主机全部信息

Get-ADComputer -Filter * -Property * | Export-CSV adcomputerall.csv -NoTypeInformation -Encoding UTF8

导出域内主机部分信息

Get-ADComputer -Filter * -Property * | Select-Object Name,IPv4Address,OperatingSystem,OperatingSystemServicePack,OperatingSystemVersion,LastLogonDate,PasswordLastSet,CanonicalName | Export-CSV adcomputerpart.csv -NoTypeInformation -Encoding UTF8

(获取域用户信息可使用 Get-ADUser)

ERROR

[Powershell]导出域内主机信息_第1张图片

确认ADWS状态

Get-WmiObject –class Win32_Service –filter ‘name=”adws”’

重启ADWS

restart-services -name adws

载入模块重新执行

import-module act*

解决办法详见
Problem using Active Directory Web Services?
Using the Active Directory PowerShell Cmdlets

参考

Active Directory Cmdlets in Windows PowerShell
Get-ADComputer
Active Directory: Get-ADComputer Default and Extended Properties
Get-ADUser
Active Directory: Get-ADUser Default and Extended Properties
利用Powershell查询AD中电脑
What’s New in AD DS: Active Directory Web Services

你可能感兴趣的:(系统运维)