0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

ActiveDirectoryでPC一覧をcsvで取得

Last updated at Posted at 2023-09-02

やり方

ActiveDirectory上でPowerShellを起動して下記コマンド。

Get-ADComputer -Filter * -Properties * | Export-Csv 出力先csvパス

取得できるcsvのカラム一覧

AccountExpirationDate
accountExpires
AccountLockoutTime
AccountNotDelegated
AllowReversiblePasswordEncryption
AuthenticationPolicy
AuthenticationPolicySilo
BadLogonCount
badPasswordTime
badPwdCount
CannotChangePassword
CanonicalName
Certificates
CN
codePage
CompoundIdentitySupported
countryCode
Created
createTimeStamp
Deleted
Description
DisplayName
DistinguishedName
DNSHostName
DoesNotRequirePreAuth
dSCorePropagationData
Enabled
frsComputerReferenceBL
HomedirRequired
HomePage
instanceType
IPv4Address
IPv6Address
isCriticalSystemObject
isDeleted
KerberosEncryptionType
LastBadPasswordAttempt
LastKnownParent
lastLogoff
lastLogon
LastLogonDate
lastLogonTimestamp
localPolicyFlags
Location
LockedOut
logonCount
ManagedBy
MemberOf
MNSLogonAccount
Modified
modifyTimeStamp
msDS-SupportedEncryptionTypes
msDS-User-Account-Control-Computed
Name
nTSecurityDescriptor
ObjectCategory
ObjectClass
ObjectGUID
objectSid
OperatingSystem
OperatingSystemHotfix
OperatingSystemServicePack
OperatingSystemVersion
PasswordExpired
PasswordLastSet
PasswordNeverExpires
PasswordNotRequired
PrimaryGroup
primaryGroupID
PrincipalsAllowedToDelegateToAccount
ProtectedFromAccidentalDeletion
pwdLastSet
rIDSetReferences
SamAccountName
sAMAccountType
sDRightsEffective
serverReferenceBL
ServiceAccount
servicePrincipalName
ServicePrincipalNames
SID
SIDHistory
TrustedForDelegation
TrustedToAuthForDelegation
UseDESKeyOnly
userAccountControl
userCertificate
UserPrincipalName
uSNChanged
uSNCreated
whenChanged
whenCreated

1行目はカラム名になっていない

csvの1行目は
#TYPE Microsoft.ActiveDirectory.Management.ADComputer
という文字列になっています。

2行目がカラム名になっています。

蛇足

LastLogonDate
OperatingSystemVersion
PasswordLastSet
IPv4Address
IPv6Address
あたりの情報が棚卸で役立ちます。

これらのActiveDirectoryが持っている情報の更新タイミングについて…

  • クライアントPCの再起動&サインインをすると更新されました。
  • クライアントPC側の設定変更直後やサインアウト&サインインだけでは更新されなかったです。

リアルタイムに情報が更新される訳ではないことに注意。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?