例如,如果想要返回计算机对象的IP地址和操作系统服务包信息,可以使用以下命令: Get-ADComputer -Filter * -Properties IPv4Address, OperatingSystemServicePack 这将返回包含计算机名称、DNS主机名、IP地址和操作系统服务包信息的计算机对象列表。 Get-ADComputer的应用场景包括但不限于: 系统管理:通过获取计算机对象的...
Get-ADComputer -Filter <string> [-ResultPageSize <int>] [-ResultSetSize <System.Nullable[System.Int32]>] [-SearchBase <string>] [-SearchScope {<Base> | <OneLevel> | <Subtree>}] [-AuthType {<Negotiate> | <Basic>}] [-Credential <PSCredential>] [-Partition <string>] [-Properties <...
-or- Get-ADUser -filter {(mail -eq "*") -and (sn -eq "Smith")}To get all user objects who have not logged on since January 1, 2007, use the following commands: $logonDate = New-Object System.DateTime(2007, 1, 1) Get-ADUser -filter { lastLogon -le $logonDate }To...
代码语言:javascript 运行 AI代码解释 $Servers = (Get-ADComputer -Filter { Enabled -eq $True -and OperatingSystem -like "*Server*" } -Properties OperatingSystem -SearchBase "DC=DOMAIN,DC=com") | Where-Object { Test-Connection $_.Name -Count 1 -Quiet } | Select-Object -ExpandProperty Name...
Get-ADComputer -filter * -properties operatingsystem,LastLogonDate,canonicalname | select name,canonicalname,operatingsystem,LastLogonDate | Export-CSV c:\computers.csv -NoTypeInformation Export Enabled and Disabled Computers to CSV Earlier, we used filters to search for enabled and disabled computer...
{get-adcomputer -filter * -SearchBase "DC=anotherdomain,DC=forest,DC=root" -Server 'FQDNLOCALDOMAINDCSERVERNAME' -properties * -ErrorAction SilentlyContinue | select Name,IPV4Address,OperatingSystem,OperatingSystemServicePack } #STILL has an issue with cross domain auth with a full trust ...
与其直接将输出通过管道传输到Where-Object { Test-Connection ... }(每次我们等待ping超时时,Where-...
Get-ADComputer-Filter"OperatingSystem -eq 'Windows 10' -or OperatingSystem -eq 'Windows 11'"|ft 以下に示すように、Export-CSVコマンドレットを使用して、エクスポートされたデータの宛先を指定すると、コマンドレットの結果をエクスポートできます。
Get-ADComputer -Filter 'operatingsystem -like "*Windows server*" -and enabled -eq "true"' -Properties Name,Operatingsystem, OperatingSystemVersion, OperatingSystemServicePack,IPv4Address | Sort-Object -Property Operatingsystem | Select-Object -Property Name,Operatingsystem, OperatingSystemVersion, Operat...
Get-ADUser -filter {(mail -eq "*") -and (sn -eq "Smith")} To get all user objects who have not logged on since January 1, 2007, use the following commands: $logonDate = New-Object System.DateTime(2007, 1, 1) Get-ADUser -filter { lastLogon -le $logonDate } To get all ...