I’ve created multiple BigFix actions that create a temporary PowerShell script and execute flawlessly.
However, I have one that is failing before it even finishes writing the script. There seems to be something that is making BF exit abruptly and support has been unable to help me identify the issue.
I have narrowed it down to a single line that is causing the failure, it’s after the pipe. Parenthesis or not, this fails.
Failed Get-LocalUser | Where {($_.name -eq ‘OneAdmin’)}
As part of troubleshooting with HCL support I removed everything after the pipe and replaced it with write-host. This proves the pipe is not the issue.
Completed // Disable wow64 redirection on x64 OSes
Completed action uses wow64 redirection {not x64 of operating system}
Completed delete __createfile
Completed // CREATEFILE
Completed createfile until END_OF_FILE
Completed
Completed Start-Transcript C:\temp\joesbftest.txt -Verbose
Completed
Completed #If default Administrator already exist as OneAdmin then change to Administrator_Disabled
Completed Get-LocalUser | write-host
Completed
Completed
Completed Stop-Transcript
Completed
Completed END_OF_FILE
Completed delete powershell.ps1
Completed move __createfile powershell.ps1
Completed waithidden { pathname of file ((it as string) of value “Path” of key “HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\PowerShell\1\ShellIds\Microsoft.PowerShell” of native registry) } -ExecutionPolicy Bypass -File powershell.ps1
So why is this failing? It’s not a PowerShell issue. It runs without issue in PowerShell. Support asked me to run PowerShell as System, I did, it worked. It’s not even executing PowerShell at this point, it’s still writing to the file. It shouldn’t matter what I put in this file at this point, it’s just writing to a file. I’ve proven it doesn’t execute as it writes to file because on the successful run above it created a transcript. On this failed run there is no transcript.
I have tried the new BigFix PowerShell action option and it fails at the same place. I have also tried to put this script into a .ps1 file and just download and execute it locally from the client but it fails to download. There is something about that line that BigFix really doesn’t like.
Completed // Disable wow64 redirection on x64 OSes
Completed action uses wow64 redirection {not x64 of operating system}
Completed delete __createfile
Completed // CREATEFILE
Completed createfile until END_OF_FILE
Completed
Completed Start-Transcript C:\temp\joesbftest.txt -Verbose
Completed
Completed #If default Administrator already exist as OneAdmin then change to Administrator_Disabled
Failed Get-LocalUser | Where {($_.name -eq ‘OneAdmin’)}
Stop-Transcript
END_OF_FILE
delete powershell.ps1
move __createfile powershell.ps1
waithidden { pathname of file ((it as string) of value “Path” of key “HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\PowerShell\1\ShellIds\Microsoft.PowerShell” of native registry) } -ExecutionPolicy Bypass -File powershell.ps1
strong text