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

lalajee 1,821 Reputation points
2021-06-17T08:44:27.193+00:00

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 for business Windows Server User experience PowerShell
Windows for business Windows Client for IT Pros User experience Other
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Anonymous
    2021-06-17T10:13:00.03+00:00

    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.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.