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

lalajee 1,811 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 10
Windows 10
A Microsoft operating system that runs on personal computers and tablets.
11,448 questions
Windows
Windows
A family of Microsoft operating systems that run across personal computers, tablets, laptops, phones, internet of things devices, self-contained mixed reality headsets, large collaboration screens, and other devices.
5,275 questions
Windows Server PowerShell
Windows Server PowerShell
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.PowerShell: A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
5,504 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Ian Xue (Shanghai Wicresoft Co., Ltd.) 36,071 Reputation points Microsoft Vendor
    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.