Hi,
I've got a little powershell script that creates a text file with an encrypted string. This string is read by the New-Mailbox -Password commandlet as part of a tool used by our helpdesk to create new users in AD.
This password is the same for all new user accounts, however each user that installs the new user app has to regenerate the hash password. I've written an HTA setup programme to generate this password rather than using the powershell command, however I cannot get it to take the password from the text box within the HTA.
The command line code:
I've changed from above to:
However, I get an error saying it needs a value expression to the right of the '-'.
I can get the password from the HTA into the powershell command, but I cannot get it to convert it.
If anybody can point me in the right direction, I'd be most grateful.
Many thanks
Can anyone
I've got a little powershell script that creates a text file with an encrypted string. This string is read by the New-Mailbox -Password commandlet as part of a tool used by our helpdesk to create new users in AD.
This password is the same for all new user accounts, however each user that installs the new user app has to regenerate the hash password. I've written an HTA setup programme to generate this password rather than using the powershell command, however I cannot get it to take the password from the text box within the HTA.
The command line code:
Code:
$secure = Read-Host "Enter Password" -asSecureString
$bytes = ConvertFrom-SecureString $secure
$bytes | Out-File defaultPassword.txt
I've changed from above to:
Code:
param($strPassword)
$secure = $strPassword -asSecureString
$bytes = ConvertFrom-SecureString $secure
$bytes | Out-File defaultPassword.txt
However, I get an error saying it needs a value expression to the right of the '-'.
I can get the password from the HTA into the powershell command, but I cannot get it to convert it.
If anybody can point me in the right direction, I'd be most grateful.
Many thanks
Can anyone