I had some other issues on the test box which I’ve worked out, you were right, that the powershell command and the powershell core command do not match up. Putting powershell core on the system and manually running
pwsh.exe -ExecutionPolicy Bypass -command "Test-Connection XX.XXX.XXX.XXX -TcpPort XXX |Out-File "C:\windows\temp\bigfix_test_powershell.txt"
Does create a single line true false file. Unfortunately, the IF statement still kicks a syntax error, and the fixlet is not processing the commands before that point. No prefetch happens, so PWSH.exe can’t run, so the file cant be created. Is there a method for ignoring syntax errors like this that come up before the script has processed?
New script for reference:
//Prefetch
prefetch 333573349cf680f43f8ce1cf6215205ba73c26e7 sha1:333573349cf680f43f8ce1cf6215205ba73c26e7 size:758659188 http://LAB-GLD-BFX.ops.lab.local:52311/Uploads/333573349cf680f43f8ce1cf6215205ba73c26e7/acronisinstaller.tmp sha256:6fdce4dcec423350a92622bbc6d58d995582595be4fde70bc865e1e9d8712e96
// Cache Powershell Core Runtime
parameter "PowershellDir"="{pathname of data folder of client}/__Global/Verve/Asset Discovery/Runtime/7.1.0-p5"
if {not exists folder (parameter "PowershellDir")}
folder create "{parameter "PowershellDir"}"
if { Windows of Operating System }
prefetch unzip.exe sha1:e1652b058195db3f5f754b7ab430652ae04a50b8 size:167936 http://software.bigfix.com/download/redist/unzip-5.52.exe SHA256:8D9B5190AACE52A1DB1AC73A65EE9999C329157C8E88F61A772433323D6B7A4A
if{x64 of operating system}
prefetch PSCore.zip sha1:81B3FCDA2DF7B2F67B7DB6B7F4F618EDADCA58D9 size:100133000 https://github.com/PowerShell/PowerShell/releases/download/v7.1.0-preview.5/PowerShell-7.1.0-preview.5-win-x64.zip sha256:87E318629B478DFB8B0F65C1D6F964943F3AD54185AAF9662A8D21F4E6FDA1F1
else
prefetch PSCore.zip sha1:58E9B96BA05EE08A5E414C112202475CD70085B1 size:90494207 https://github.com/PowerShell/PowerShell/releases/download/v7.1.0-preview.5/PowerShell-7.1.0-preview.5-win-x86.zip sha256:F92FB9F03C0A033642A5F1E87E0517872D4D3F27CED0A80EDCB9C4F81636419D
endif
waithidden __Download\unzip.exe -o "{pathname of client folder of current site}\__Download\PSCore.zip" -d "{parameter "PowershellDir"}"
elseif {Unix of Operating System}
prefetch PSCore.tar.gz sha1:3D1B1825EA36AAB9AA725E9CE9CCBC64029DE45B size:68635738 https://github.com/PowerShell/PowerShell/releases/download/v7.1.0-preview.5/powershell-7.1.0-preview.5-linux-x64.tar.gz sha256:F58FE99DDF456C3D987E50F1486A805A56A1A6DDF1CA2B9F2E39974181E17DFC
wait tar xzf "__Download/PSCore.tar.gz" -C "{parameter "PowershellDir"}"
else
exit 10
endif
endif
//TEST CONNECTION TO MANAGEMENT SERVER
//Run port test
delete C:\windows\temp\bigfix_test_powershell.txt
action uses wow64 redirection false
waithidden "{pathname of file whose (name of it = "pwsh" or name of it = "pwsh.exe") of folder (parameter "PowershellDir")}" -ExecutionPolicy Bypass -command "Test-Connection XXX.XXX.XXX.XXX -TcpPort XXXX |Out-File "C:\windows\temp\bigfix_test_powershell.txt"
action uses wow64 redirection {x64 of operating system}
//analyze result
if{(it contains "False") of Line 1 of file "C:\windows\temp\bigfix_test_powershell.txt"}
exit 9
endif
if{(it contains "True") of Line 1 of file "C:\windows\temp\bigfix_test_powershell.txt"}
//createfile until _end_
//success
//_end_
//move __createfile c:\temp\success.txt
extract 333573349cf680f43f8ce1cf6215205ba73c26e7
wait "{pathname of system folder & "\msiexec.exe"}" /i "{(pathname of client folder of current site) & "\__Download\AB64.msi"}" /qn /l*v install.log TRANSFORMS="{(pathname of client folder of current site) & "\__Download\AB64.msi.mst"}"
endif