Export Computer Object Information from Active Directory

Share on twitter
Share on linkedin
Share on facebook
Share on stumbleupon
Share on xing
Share on email
Share on print

Sometimes you might be interested in gathering a list of all computer from an Active Directory domain in preparation for migration.

You can gather a list of all computer objects using the following command.

# Fetch a sorted list of all computer objectsGet-ADComputer -Filter * -Property * | Sort-Object Name 

 

The wildcard used with the Property parameter fetches all available attributes for a computer object. Check the available attributes in the result set to identify the attributes you are interested in.

# Example output for the first computer object gathered from Active Directory(Get-ADComputer -Filter * -Property * | Sort-Object Name)[0]AccountExpirationDate                : accountExpires                       : 9223372036854775807AccountLockoutTime                   : AccountNotDelegated                  : FalseAllowReversiblePasswordEncryption    : FalseBadLogonCount                        : 0badPasswordTime                      : 0badPwdCount                          : 0CannotChangePassword                 : FalseCanonicalName                        : DOMAIN.local/Computers/COMPUTER01Certificates                         : {}CN                                   : COMPUTER01codePage                             : 0CompoundIdentitySupported            : {False}countryCode                          : 0Created                              : 9/2/2013 3:01:13 PMcreateTimeStamp                      : 9/2/2013 3:01:13 PMDeleted                              : Description                          : DisplayName                          : DistinguishedName                    : CN=COMPUTER01,CN=Computers,DC=DOMAIN,DC=localDNSHostName                          : COMPUTER01.DOMAIN.localDoesNotRequirePreAuth                : FalsedSCorePropagationData                : {12/31/1600 7:00:00 PM}Enabled                              : TrueHomedirRequired                      : FalseHomePage                             : instanceType                         : 4IPv4Address                          : IPv6Address                          : isCriticalSystemObject               : FalseisDeleted                            : KerberosEncryptionType               : {RC4, AES128, AES256}LastBadPasswordAttempt               : LastKnownParent                      : lastLogoff                           : 0lastLogon                            : 130942520427754509LastLogonDate                        : 12/10/2015 3:02:53 PMlastLogonTimestamp                   : 130942513734007331localPolicyFlags                     : 0Location                             : LockedOut                            : FalselogonCount                           : 194ManagedBy                            : MemberOf                             : {}MNSLogonAccount                      : FalseModified                             : 12/10/2015 3:02:53 PMmodifyTimeStamp                      : 12/10/2015 3:02:53 PMmsDS-SupportedEncryptionTypes        : 28msDS-User-Account-Control-Computed   : 0Name                                 : COMPUTER01nTSecurityDescriptor                 : System.DirectoryServices.ActiveDirectorySecurityObjectCategory                       : CN=Computer,CN=Schema,CN=Configuration,DC=DOMAIN,DC=localObjectClass                          : computerObjectGUID                           : da59afcc-e00a-430b-9cbc-01adeed568f3objectSid                            : S-1-5-21-3143343262-845931634-422089675-1179OperatingSystem                      : Windows 7 ProfessionalOperatingSystemHotfix                : OperatingSystemServicePack           : Service Pack 1OperatingSystemVersion               : 6.1 (7601)PasswordExpired                      : FalsePasswordLastSet                      : 12/2/2014 7:21:09 AMPasswordNeverExpires                 : FalsePasswordNotRequired                  : FalsePrimaryGroup                         : CN=Domain Computers,CN=Users,DC=DOMAIN,DC=localprimaryGroupID                       : 515PrincipalsAllowedToDelegateToAccount : {}ProtectedFromAccidentalDeletion      : FalsepwdLastSet                           : 130619964697110685SamAccountName                       : COMPUTER01$sAMAccountType                       : 805306369sDRightsEffective                    : 15ServiceAccount                       : {}servicePrincipalName                 : {RestrictedKrbHost/COMPUTER01, HOST/COMPUTER01,                                        RestrictedKrbHost/COMPUTER01.DOMAIN.local, HOST/COMPUTER01.DOMAIN.local}ServicePrincipalNames                : {RestrictedKrbHost/COMPUTER01, HOST/COMPUTER01,                                        RestrictedKrbHost/COMPUTER01.DOMAIN.local, HOST/COMPUTER01.DOMAIN.local}SID                                  : S-1-5-21-3143343262-845931634-422089675-1179SIDHistory                           : {}TrustedForDelegation                 : FalseTrustedToAuthForDelegation           : FalseUseDESKeyOnly                        : FalseuserAccountControl                   : 4096userCertificate                      : {}UserPrincipalName                    : uSNChanged                           : 1721509uSNCreated                           : 45981whenChanged                          : 12/10/2015 3:02:53 PMwhenCreated                          : 9/2/2013 3:01:13 PM

 

As a next step, you gather the selected information and 

# Fetch data for an operating system overview, sorted by property Name onlyGet-ADComputer -Filter * -Property * | Sort-Object Name | Select Name,OperatingSystem,OperatingSystemServicePack,OperatingSystemVersion # Fetch data for an operating system overview, sorted by property OperatingSystem first, then Name Get-ADComputer -Filter * -Property * | Sort-Object OperatingSystem,Name | Select Name,OperatingSystem,OperatingSystemServicePack,OperatingSystemVersion 

 

You can export the gathered information to a comma separated file easily using the Export-Csv cmdlet.

# Export the gathered and sorted information to a CSV file using a semicolon as the delimiter# Adjust the file path for the CSV file to fit your environmentGet-ADComputer -Filter * -Property * | Sort-Object OperatingSystem,Name | Select Name,OperatingSystem,OperatingSystemServicePack,OperatingSystemVersion | Export-Csv -Path C:SCRIPTSComputerOverview.csv -NoClobber -NoTypeInformation -Delimiter ';' 

 

Link

 

Enjoy!

%d Bloggern gefällt das: