我无法完全找到解决方案的傻问题。
尝试列出Get-ADUser和Get-ADComputer的所有属性名称,以便我可以将属性列表加载到对话框的组合框中以供选择以运行报告。 例如;
AccountExpirationDate :, accountExpires :, AccountLockoutTime :, AccountNotDelegated :, AllowReversiblePasswordEncryption :, AuthenticationPolicy :, AuthenticationPolicySilo :, BadLogonCount :, c :, CannotChangePassword :, CanonicalName :, Certificates :, City :, CN :, co :, codePage: ,公司:,CompoundIdentitySupported :、国家/地区:,国家/地区代码:,创建时间:,createTimeStamp :、已删除:,部门:,描述:,显示名称:,专有名称:,部门:,DoesNotRequirePreAuth:,dSCorePropagationData :、电子邮件地址:,员工ID :、员工编号:,employeeType :, Enabled :, extensionAttribute1 :, extensionAttribute4 :, extensionAttribute5 :, Fax :, GivenName :, HomeDirectory :, HomedirRequired :, HomeDrive :, HomePage :, HomePhone :, Initials :, instanceType :, ipPhone :, isDeleted :, KerberosEncryptionType :, l :,语言:,LastBadPasswordAttempt :, LastKnownParent :, lastLogon :, LastLogonDate :, lastLogonTimestamp :, LockedOut :, logonCount :, LogonWorkstations :,邮件:,Manager :, MemberOf :, MNSLogonAccount :,移动电话:,已修改:,modifyTimeStamp:,msDS-User-Account-Control-Compulated:,msNPAllowDialin:,msRTCSIP-DeploymentLocator:,msRTCSIP-FederationEnabled:,msRTCSIP-InternetAccessEnabled:,msRTCSIP-OptionFlags:,msRTCSIP-PrimaryHomeServer:,msRTCSIP-PrimaryUserServer :,msRTCSIP-UserEnabled :, msRTCSIP-UserPolicies :, msRTCSIP-UserPolicy :, msRTCSIP-UserRoutingGroupId :,名称:,nTSecurityDescriptor :, ObjectCategory :, ObjectClass :, ObjectGUID :, objectSid :, Office :, OfficePhone :, Organization :, OtherName :,PasswordExpired:,PasswordLastSet:,PasswordNeverExpires:,PasswordNotRequired:,physicalDeliveryOfficeName:,POBox:,PostalCode:,preferredLanguage:,PrimaryGroup:,primaryGroupID:,PrincipalsAllowedToDelegateToAccount:,ProfilePath:,ProtectedFromAccidentalDeletion:,proxyAddressesSet:,proxyAddressesSetName: sAMAccountType :, ScriptPath :, sDRightsEffective :, ServicePrincipalNames :, SID :, SIDHistory :, SmartcardLogonRequired :, sn :, st :, State :, StreetAddress :, Surname :, phoneNumber :, Title :, TrustedForDelegation:,TrustedToAuthForDelegation:,url:,UseDESKeyOnly:,userAccountControl:,userCertificate:,userParameters:,UserPrincipalName:,uSNChanged:,uSNCreated:,whenChanged:,whenCreated:,wWWHomePage:
答案 0 :(得分:1)
一种列出properties
中所有Get-ADUser
的方法
Get-ADUser -Properties * -Filter * | Get-Member
与Get-ADComputer
Get-ADComputer -Properties * -Filter * | Get-Member
答案 1 :(得分:1)
您还可以仅从特定 OU 的 AD 中获取所需的字段,而不是遍历整个 AD。
更改任何 label = "some text"
将更改导出的 csv 上的名称。
如果您不得不多次调用相同的数据,这使得重用非常方便。
Import-Module Activedirectory
$Data=@(
Get-ADUser -Filter {Enabled -eq $true} -SearchBase “ou=User Accounts,ou=UserAccounts,dc=hiscox,dc=com” -Properties EmailAddress, extensionattribute2 |
Select-Object @{Label = "First Name";Expression = {$_.GivenName}}, @{Name = "Last Name";Expression = {$_.Surname}}, @{Name = "Email";Expression = {$_.EmailAddress}}, @{Name = "Business Area";Expression = {$_.extensionattribute2}}
)
$Data | Export-Csv -Path c:\adusers.csv -NoTypeInformation
答案 2 :(得分:0)
Get-ADUser | gm | where MemberType -eq property