Skip to main content

Building a worklet for password management and getting the error below. I created the secret etc. Calling the variable using $secretnamehere and the error is what we get. When I go back to check the Secret Value, click the eye it is empty...but I filled it in lol So is this by design?? Am i just totally n00bing this up lol!?!

 

powershell.exe : Cannot bind argument to parameter 'String' because it is null.
At C:\Program Files (x86)\Automox\execDir535623559\execcmd917210426.ps1:150 char:11
+ ... return & "$env:SystemRoot\sysnative\WindowsPowerShell\v1.0\power ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidData: (:) ConvertTo-SecureString], ParameterBindingValidationException
+ FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,Microsoft.PowerShell.Commands.ConvertToSe
cureStringCommand


COMMAND TIMED OUT.

 

I should clarify it is for LOCAL account password management, of a renamed account lol.


Looks like you are using a scriptblock and routing that to run a 64-bit version of PowerShell. Which makes sense given Set-Local user only works in 64-bit PowerShell.

Could go for living off the land, which still works in 32-bit powershell

net user [username] $secretnamehere 

Otherwise I’d be analyzing the scriptblock to make sure the variable is being passed into it correctly.

$scriptblock = {

$UserAccount = Get-LocalUser -Name "User02"
$UserAccount | Set-LocalUser -Password $secretnamehere

}

& "$env:SystemRoot\sysnative\WindowsPowerShell\v1.0\powershell.exe" -ExecutionPolicy Bypass -WindowStyle Hidden -NoProfile -NonInteractive -Command $scriptblock

You can really find out by adding some unique code in the scriptblock to tell you things… like this

$scriptblock = {
IF($secretnamehere){'that worked' | out-file C:\windows\temp\test.txt}
}

Write-Output "Secret passed into scriptblock: $(Get-Content C:\windows\temp\test.txt)"

 


Reply