Check if PasswordNeverExpire is True or False and store and store it in variable
hello all,
sorry if english not well.
i need store status of user properties "passwordneverexpires" in variable use later in command of script.
for exemple:
$status = get-aduser -identity user1 -properties passwordneverexpires | select passwordneverexpires
new-aduser -name test -passwordneverexpires $status
thank muhc help
orwell
hi,
you can adding in -expandproperty select-object:
$status = get-aduser -identity tester1 -properties passwordneverexpires | select-object -expandproperty passwordneverexpires $status
alternatively, can reference .passwordneverexpires property of $status object in new-aduser command if don't change current select-object statement.
new-aduser -name test -passwordneverexpires $status.passwordneverexpires
Windows Server > Windows PowerShell
Comments
Post a Comment