昌邑市建设局网站,十堰网站建设报价,吉安市网站制作,上海建筑网站大全通过使用Get-Adcomputer和Get-Wmiobject 组合来实现。思路是这样的#xff0c;先看一台服务器的属性值有什么可用利用的。[12r2-dc]: PS C:\ Get-ADComputer -Identity 12r2-dc -Properties *AccountExpirationDate :accountExpires … 通过使用Get-Adcomputer和Get-Wmiobject 组合来实现。思路是这样的先看一台服务器的属性值有什么可用利用的。[12r2-dc]: PS C:\ Get-ADComputer -Identity 12r2-dc -Properties *AccountExpirationDate :accountExpires : 9223372036854775807AccountLockoutTime :AccountNotDelegated : FalseAllowReversiblePasswordEncryption : FalseAuthenticationPolicy : {}AuthenticationPolicySilo : {}BadLogonCount : 0badPasswordTime : 0badPwdCount : 0CannotChangePassword : FalseCanonicalName : abc.com/Domain Controllers/12R2-DCCertificates : {System.Security.Cryptography.X509Certificates.X509Certificate}CN : 12R2-DCcodePage : 0CompoundIdentitySupported : {False}countryCode : 0Created : 10/9/2016 10:29:00 PMcreateTimeStamp : 10/9/2016 10:29:00 PMDeleted :Description :DisplayName :DistinguishedName : CN12R2-DC,OUDomain Controllers,DCabc,DCcomDNSHostName : 12R2-DC.abc.comDoesNotRequirePreAuth : FalsedSCorePropagationData : {10/9/2016 10:29:03 PM, 12/31/1600 4:00:01 PM}Enabled : TrueHomedirRequired : FalseHomePage :instanceType : 4IPv4Address : 169.254.15.118IPv6Address :isCriticalSystemObject : TrueisDeleted :KerberosEncryptionType : {RC4, AES128, AES256}LastBadPasswordAttempt :LastKnownParent :lastLogoff : 0lastLogon : 131498622097210925LastLogonDate : 9/10/2017 11:04:43 PMlastLogonTimestamp : 131495834837332604localPolicyFlags : 0Location :LockedOut : FalselogonCount : 1860ManagedBy :MemberOf : {CNPre-Windows 2000 Compatible Access,CNBuiltin,DCabc,DCcom, CNCert Publishers,CNUsers,DCabc,DCcom}MNSLogonAccount : FalseModified : 9/12/2017 7:23:19 PMmodifyTimeStamp : 9/12/2017 7:23:19 PMmsDFSR-ComputerReferenceBL : {CN12R2-DC,CNTopology,CNDomain System Volume,CNDFSR-GlobalSettings,CNSystem,DCabc,DCcom}msDS-GenerationId : {45, 30, 43, 189...}msDS-SupportedEncryptionTypes : 28msDS-User-Account-Control-Computed : 0Name : 12R2-DCnTSecurityDescriptor : System.DirectoryServices.ActiveDirectorySecurityObjectCategory : CNComputer,CNSchema,CNConfiguration,DCabc,DCcomObjectClass : computerObjectGUID : bf0a2518-aa9c-4cb9-ab8e-09be04b3e27bobjectSid : S-1-5-21-2770570338-4234891044-2636713416-1001OperatingSystem : Windows Server 2012 R2 StandardOperatingSystemHotfix :OperatingSystemServicePack :OperatingSystemVersion : 6.3 (9600)PasswordExpired : FalsePasswordLastSet : 8/20/2017 4:58:11 PMPasswordNeverExpires : FalsePasswordNotRequired : FalsePrimaryGroup : CNDomain 看到这里就知道利用哪个属性值了过滤一下用一个通配符表达式或是任何一个能把这个值抓住的条件就可以再用一个选择语句把名字选择出来。$computer Get-ADComputer -Filter {operatingsystem -like *20*} | select -ExpandProperty name然后运行了一下Get-Wmiobject,结果如下[12r2-dc]: PS C:\ Get-WmiObject -Class win32_computersystemDomain : abc.comManufacturer : Microsoft CorporationModel : Virtual MachineName : 12R2-DCPrimaryOwnerName : Windows UserTotalPhysicalMemory : 2094039040然后想到如果把变量$computer传递进来再把两个属性暴露出来就会产生一个结果集当然你愿意输出到文件自己再用管道符输出就是了。Invoke-Command -ComputerName $computer {Get-WmiObject win32_computersystem} -ErrorAction SilentlyContinue | select name,model | sort model结果就是Name Model---- -----12R2-SCCM Virtual Machine 转载于:https://blog.51cto.com/shadingyu/1965482