Perl script not working as expected in Bigfix action script

Hi All, I need assistance on below mentioned script which should work as a part of Bigfix action which installs a SDK software on windows server 2008 and then creates a certificate and then runs the below mentioned script :-1:
createfile until END_OF_FILE
$cert = Get-ChildItem cert:\LocalMachine\My -Recurse | Where-Object {{ $_.Subject -like “myHost”}
$thumbprint = $cert.thumbprint
echo $thumbprint
New-Item -Path WSMan:\LocalHost\Listener -Transport HTTPS -Address * -CertificateThumbPrint $cert.thumbprint –Force

delete powershell.ps1
move __CreateFile powershell.ps1
move “powershell.ps1” “C:\temp\powershell.ps1”
waithidden powershell -ExecutionPolicy Bypass -command C:\temp\powershell.ps1

Please suggest if above mentioned script requires a correctio. Its working manually as shown in the screenshot below:-1:

Ummm - it is PowerShell, not perl.

Also, you are trying to pass powershell a file. not a command

waithidden powershell -ExecutionPolicy Bypass -file C:\temp\powershell.ps1

my bad, its power shell so how would I process it like a command?

Why would you want to process it as a command? You have created a script file and tested it and I have given you the ActionScript line to execute the script.

Got it now!! Thank you.

The failing on the below commands, can you suggest:-1:
Completed move __CreateFile powershell.ps1
Failed move “powershell.ps1” "C:\temp\powershell.ps1"
waithidden powershell -ExecutionPolicy Bypass -file C:\temp\powershell.ps1

Your move of the file to its final destination is convoluted and has errors because you are not ensuring the target for the final move does not exist and move (and copy) fail if the target already exists.
Also, I prefer copy to move because the permissions on the resulting file are clearer.

delete __createfile
delete "C:\temp\powershell.ps1"
create file until END_OF_FILE
.. <your>
.. <script>
.. <here>
copy __CreateFile  "C:\temp\powershell.ps1"
waithidden powershell -ExecutionPolicy Bypass -command C:\temp\powershell.ps1
1 Like

Shouldn’ it be as below in the last line:-1:
waithidden powershell -ExecutionPolicy Bypass -file C:\temp\powershell.ps1


One more question, I have an analysis to check if the KB package is installed in win 2003 servers or now by the following relevance :-1:

exists (string values of properties “HotFixID” of it) whose(it starts with “KB4500331”) of select objects “HotFixID from Win32_QuickFixEngineering” of wmis

can you please tell me the relevance I can use to check as to which date it was installed on a particular server and can fetch from web reports?

Yep, I copied and pasted your original and overlooked editing one thing that has been correctly suggested to you in an earlier post.

Having answered one question does not put me on the hook for answering every query you have about Bigfix - like most of the contributors to this forum I do not work for Bigfix, IBM or HCL. I try to help with things that are either quick and easy to assist newbies or with stuff that is a bit whacky and interesting to me. Beyond that I will not spend time doing something that a quick read of the documentation and a search of this forum will probably answer. I appreciate that the above may make me sound grumpy or unhelpful, but I am a contractor and contributing to this forum is not invoicable work.


You should probably start that as a new thread, as it’s a separate topic and someone who knows how to retrieve this may not browse through all of the Poweshell in this thread to find your question

1 Like

Yes you are right, I have a separate thread and a relevance code, I just need to know where to use the KB article as a string