getting ad user properties
hello guys,
i need script i'm working on. think should work, when divide code works. can please tell me i'm doing wrong? thank you
[string]$info = "cannotchangepassword","city","company","country" $user = get-aduser user -properties * $user | foreach {select -expandproperty ($info | foreach {$info})}
if want property value in same line.
single user (use / or - or space between {0}{1}as per need)
$user = get-aduser vincent -properties cannotchangepassword,city,company,country '{0}/{1}/{2}/{3}' -f $user.cannotchangepassword,$user.city,$user.company,$user.country
output:
false/mumbai/surgesystem/in
for multiple user
get-aduser -filter {name -like 'vin*'} -properties cannotchangepassword,city,company,country | foreach { '{0}/{1}/{2}/{3}' -f $_.cannotchangepassword,$_.city,$_.company,$_.country }
Windows Server > Windows PowerShell
Comments
Post a Comment