Skip to main content
Question

Secrets


CallmePH
Forum|alt.badge.img

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.

 

2 replies

CallmePH
Forum|alt.badge.img
  • Author
  • Pro
  • 52 replies
  • June 13, 2024

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


jack.smith
Forum|alt.badge.img+1
  • All Star
  • 168 replies
  • June 19, 2024

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


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings