So I found a fixlet that should allow me to run a ps script. Here is mine:
// Disable wow64 redirection on x64 OSes
action uses wow64 redirection {not x64 of operating system}
delete __createfile
// CREATEFILE
createfile until END_OF_FILE
# REPLACE THE FOLLOWING WITH THE SCRIPT YOU WANT TO RUN ON THE ENDPOINT
$ProgressPreference = "SilentlyContinue";
Invoke-WebRequest "https://s3.amazonaws.com/agent.exe" -OutFile $env:USERPROFILE\Desktop\agent.exe
Start-Process -FilePath $env:USERPROFILE\Desktop\agent.exe -ArgumentList "/S"
rm -Force $env:USERPROFILE\Desktop\agent.exe
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
Running it locally works, but when I run it through bigfix it’s a hit or miss.
My relevance:
- Make sure it’s a win server:
operating system as string starts with "Win2"
- ps exists:
exists file ((it as string) of value "Path" of key "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\PowerShell\1\ShellIds\Microsoft.PowerShell" of native registry)
- The agent I’m installing doesn’t exist as a service:
not exists service "agent"
When I run it on a dummy server, it just says “completed” but nothing was actually changed.
Any idea what I’m missing? I don’t even see the file being downloaded to the desktop.