question

lalajee avatar image
0 Votes"
lalajee asked IanXue-MSFT answered

How to get binary of the file without using any other application

Hi,

I have a group policy that creates a registry on a machine with binary code for the PowerShell script.

Then we have a service that runs and get the values from that reg and creates a PowerShell script on a machine that uses it.

I have updated the PowerShell script but I don't know how to convert it into binary to put it into group policy.

106535-test.png


windows-10-generalwindows-server-powershellwindows-group-policy
test.png (51.5 KiB)
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

IanXue-MSFT avatar image
0 Votes"
IanXue-MSFT answered

Hi,

Please try this.

 $file = 'C:\temp\file.ps1'
 Get-Content -Path $file -Encoding Byte

Best Regards,
Ian Xue
============================================
If the Answer is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.





5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.