Thursday, 5 April 2018

PowerShell: create a new Active Directory user with password as a secure string

Having some trouble creating a command to create a new user in PowerShell, the code I'm using is:


PS C:\Users\Nicky> New-ADUser -Name johnd -GivenName John -Surname Doe -DisplayName John Doe $secpasswd = ConvertTo-SecureString -String "pa$$word1" -AsPlainText -Force -AccountPassword $secpasswd

I can get it working without the AccountPassword, so I think the issue is when converting it to a secure string so the -AccountPassword will accept it.


Anyone any ideas on how to get this to work?

No comments:

Post a Comment

Where does Skype save my contact's avatars in Linux?

I'm using Skype on Linux. Where can I find images cached by skype of my contact's avatars? Answer I wanted to get those Skype avat...