Find all Windows Server R2 servers in the domain and differentiate which are the physical machines, those that are virtual machines

Source: Internet
Author: User

implemented by using Get-adcomputer and get-wmiobject combinations.

The idea is this, first look at the property value of a server what is available to use.


[12R2-DC]: PS c:\> get-adcomputer-identity 12r2-dc-properties *



accountExpirationDate:

accountexpires:9223372036854775807

Accountlockouttime:

Accountnotdelegated:false

Allowreversiblepasswordencryption:false

Authenticationpolicy: {}

Authenticationpolicysilo: {}

badlogoncount:0

badpasswordtime:0

badpwdcount:0

Cannotchangepassword:false

Canonicalname:abc.com/domain CONTROLLERS/12R2-DC

Certificates: {System.Security.Cryptography.X509Certificates.X509Certificate}

Cn:12r2-dc

codepage:0

compoundidentitysupported: {False}

countrycode:0

created:10/9/2016 10:29:00 PM

createtimestamp:10/9/2016 10:29:00 PM

Deleted:

Description:

DisplayName:

Distinguishedname:cn=12r2-dc,ou=domain controllers,dc=abc,dc=com

Dnshostname:12r2-dc.abc.com

Doesnotrequirepreauth:false

Dscorepropagationdata: {10/9/2016 10:29:03 pm, 12/31/1600 4:00:01 pm}

Enabled:true

Homedirrequired:false

Homepage:

Instancetype:4

ipv4address:169.254.15.118

IPv6Address:

Iscriticalsystemobject:true

IsDeleted:

Kerberosencryptiontype: {RC4, AES128, AES256}

Lastbadpasswordattempt:

lastKnownParent:

lastlogoff:0

lastlogon:131498622097210925

lastlogondate:9/10/2017 11:04:43 PM

lastlogontimestamp:131495834837332604

localpolicyflags:0

Location:

Lockedout:false

logoncount:1860

ManagedBy:

MemberOf: {cn=pre-windows Compatible access,cn=builtin,dc=abc,dc=com, Cn=cert

Publishers,cn=users,dc=abc,dc=com}

Mnslogonaccount:false

modified:9/12/2017 7:23:19 PM

modifytimestamp:9/12/2017 7:23:19 PM

Msdfsr-computerreferencebl: {cn=12r2-dc,cn=topology,cn=domain System

Volume,cn=dfsr-globalsettings,cn=system,dc=abc,dc=com}

Msds-generationid: {45, 30, 43, 189 ...}

Msds-supportedencryptiontypes:28

msds-user-account-control-computed:0

Name:12r2-dc

NTSecurityDescriptor:System.DirectoryServices.ActiveDirectorySecurity

Objectcategory:cn=computer,cn=schema,cn=configuration,dc=abc,dc=com

Objectclass:computer

objectguid:bf0a2518-aa9c-4cb9-ab8e-09be04b3e27b

objectsid:s-1-5-21-2770570338-4234891044-2636713416-1001

Operatingsystem:windows Server R2 Standard

Operatingsystemhotfix:

operatingSystemServicePack:

operatingsystemversion:6.3 (9600)

Passwordexpired:false

passwordlastset:8/20/2017 4:58:11 PM

Passwordneverexpires:false

Passwordnotrequired:false

Primarygroup:cn=domain

See here to know which property value to use, filter, with a wildcard expression or any one can take this value to catch the condition can be, and then use a SELECT statement to select the name.

$computer = get-adcomputer-filter {operatingsystem-like "*20*"} | Select-expandproperty Name

Then run the Get-wmiobject and the results are as follows:

[12R2-DC]: PS c:\> get-wmiobject-class Win32_ComputerSystem



Domain:abc.com

Manufacturer:microsoft Corporation

Model:virtual Machine

Name:12r2-dc

Primaryownername:windows User

totalphysicalmemory:2094039040


Then think of, if the variable $computer pass in, and then expose two properties, will produce a result set, of course, you are willing to output to the file itself and then the pipe character output just.


Invoke-command-computername $computer {get-wmiobject Win32_ComputerSystem}-erroraction silentlycontinue | Select Name,model | Sort model



The result is:

Name Model

----                                                        -----

12R2-SCCM Virtual Machine


This article is from the "Sardine" blog, please make sure to keep this source http://shadingyu.blog.51cto.com/2617687/1965482

Find all Windows Server R2 servers in the domain and differentiate which are the physical machines, those that are virtual machines

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.