Hi!
I have this Powershell script working on my computer:
$securepwd = '01000000d08c9ddf0115d1118c7a00c04fc297eb01000000d41fd44d4b7d6944828922848be6ea2300000000020000000000106600000001000020000000895b407ff1c1890fb548a132948b88919171c79c435f0fc1e6c432cde51c6bfd000000000e8000000002000020000000b33acaca73ca31afb784ef91dc315990803d326f86fd97f7b074c5d74c805be0200000004584b56553e5ff0f4195d20c89fa128ef4b0950aa70ea39f3bc9f38f51e3366840000000434502c90d2c48bb714db3c1d7c025e592a19c4a76cbc1cd2477427f720ed0edb9603b1c03b8aaa12056f00f1f237e5eb64d37692d32b88a292973f8ba57f686' | ConvertTo-SecureString
$Marshal = [System.Runtime.InteropServices.Marshal]
$Bstr = $Marshal::SecureStringToBSTR($securepwd)
$pwd = $Marshal::PtrToStringAuto($Bstr)
net user Administrator $pwd
It decrypts a text and uses it to change Administrator’s password.
When I run it from BigFix, I have this error:
C:\WINDOWS\system32\WindowsPowerShell\v1.0\powershell.exe -WindowStyle Hidden -ExecutionPolicy Bypass -File "c:\Program Files (x86)\BigFix Enterprise\BES Client\__BESData\__bes7.ps1"
Error executing script c:\Program Files (x86)\BigFix Enterprise\BES Client\__BESData\__bes7.ps1: ConvertTo-SecureString : El sistema no puede encontrar la ruta especificada.
En C:\Program Files (x86)\BigFix Enterprise\BES Client\__BESData\__bes7.ps1: 1 Car cter: 511
+ ... 00f1f237e5eb64d37692d32b88a292973f8ba57f686' | ConvertTo-SecureString
+ ~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (:) [ConvertTo-SecureString], CryptographicException
+ FullyQualifiedErrorId : ImportSecureString_InvalidArgument_CryptographicError,Microsoft.PowerShell.Commands.Conv
ertToSecureStringCommand
Excepci¢n al llamar a "SecureStringToBSTR" con los argumentos "1": "El valor no puede ser nulo.
Nombre del par metro: s"
En C:\Program Files (x86)\BigFix Enterprise\BES Client\__BESData\__bes7.ps1: 3 Car cter: 1
+ $Bstr = $Marshal::SecureStringToBSTR($securepwd)
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : ArgumentNullException
No se encuentra ninguna sobrecarga para "PtrToStringAuto" y el n£mero de argumentos "1".
En C:\Program Files (x86)\BigFix Enterprise\BES Client\__BESData\__bes7.ps1: 4 Car cter: 1
+ $pwd = $Marshal::PtrToStringAuto($Bstr)
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodException
+ FullyQualifiedErrorId : MethodCountCouldNotFindBest
Script ended (the script returned exit code 0 but completed with errors, exit code overridden with -1) (fixlet 227517)
At 14:08:20 -0300 -
Any idea what could it be?
Thanks!