Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How do I find all the Windows Server 2012 R2 servers in the domain and tell which are physical machines and which are virtual machines?

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/03 Report--

Independent host, that is, Dedicated Server, means that customers rent a server independently to display their website or provide their own services, which has more space and faster speed than virtual hosts, independent CPU computing and other advantages, of course, the price is also more expensive. Today, the editor introduces you to a basic idea to solve this problem:

This is achieved by using a combination of Get-Adcomputer and Get-Wmiobject.

The idea is like this, first see what the property values of a server are available to take advantage of.

[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 2000 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: Smurl 1-5-21-2770570338-4234891044-2636713416-1001

OperatingSystem: Windows Server 2012 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 attribute value to use, filter it, use a wildcard expression or any condition that can hold the value, and then use a select statement to select the name.

$computer = Get-ADComputer-Filter {operatingsystem-like "* 20*"} | select-ExpandProperty name

Then run Get-Wmiobject, and the result is 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 I thought that if you pass in the variable $computer and expose two more attributes, you will produce a result set, of course, if you are willing to output it to a file and then use pipe characters to output it yourself.

Invoke-Command-ComputerName $computer {Get-WmiObject win32_computersystem}-ErrorAction SilentlyContinue | select name,model | sort model

The result is:

Name Model

-

12R2-SCCM Virtual Machine

Summary: whether it is an independent host or a virtual host, the requirements of the two functions can be consistent in many aspects, the main differences are: 1, custom software equipment; 2, mass storage and backup; 3, need to set up a lot of websites. Therefore, users should choose whether to use physical machines or virtual machines according to their actual needs. Server rooms are spread all over many countries, and both virtual machines and physical machines have certain reputation and advantages in the industry. can meet the requirements of most users!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report