Hello,<\/p>\n
I would like to try and make a GPO that runs a PowerShell script instead of a bat file. However, they are not running. I believe that it is related to PowerShell settings being in a remote signed state:<\/p>\n
Scope ExecutionPolicy<\/p>\n
MachinePolicy Undefined
\nUserPolicy Undefined
\nProcess Undefined
\nCurrentUser Undefined
\nLocalMachine RemoteSigned<\/p>\n
I am running these scripts as NT Authority\\System, but I have a feeling that are not running because LocalMachine is set to RemoteSigned (hopefully it is not MachinePolicy). I cannot seem to figure out how to remote sign this script, can someone point me in a good direction?<\/p>\n
Thank you,<\/p>\n
Michael<\/p>","upvoteCount":8,"answerCount":9,"datePublished":"2024-02-06T20:07:40.000Z","author":{"@type":"Person","name":"spiceuser-5ypxu","url":"https://community.spiceworks.com/u/spiceuser-5ypxu"},"suggestedAnswer":[{"@type":"Answer","text":"
Hello,<\/p>\n
I would like to try and make a GPO that runs a PowerShell script instead of a bat file. However, they are not running. I believe that it is related to PowerShell settings being in a remote signed state:<\/p>\n
Scope ExecutionPolicy<\/p>\n
MachinePolicy Undefined
\nUserPolicy Undefined
\nProcess Undefined
\nCurrentUser Undefined
\nLocalMachine RemoteSigned<\/p>\n
I am running these scripts as NT Authority\\System, but I have a feeling that are not running because LocalMachine is set to RemoteSigned (hopefully it is not MachinePolicy). I cannot seem to figure out how to remote sign this script, can someone point me in a good direction?<\/p>\n
Thank you,<\/p>\n
Michael<\/p>","upvoteCount":8,"datePublished":"2024-02-06T20:07:40.000Z","url":"https://community.spiceworks.com/t/how-to-run-powershell-script-as-nt-authority-system/966580/1","author":{"@type":"Person","name":"spiceuser-5ypxu","url":"https://community.spiceworks.com/u/spiceuser-5ypxu"}},{"@type":"Answer","text":"
have you tried launching powershell with a specific ExecutionPolicy at runtime and passing the script file to this instance?<\/p>\n
something like this:<\/p>\n
powershell -ExecutionPolicy Unrestricted -File \"\\\\path\\to\\myscript.ps1\"\n\n<\/code><\/pre>\nor this:<\/p>\n
C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe -ExecutionPolicy Unrestricted -File \"\\\\path\\to\\myscript.ps1\"\n<\/code><\/pre>\nExecutionPolicy types in PowerShell:<\/strong><\/p>\nRestricted<\/strong>:<\/p>\nThis is the most restrictive policy.It doesn’t load configuration files or run scripts.It only allows individual commands to be run interactively.Useful for environments where security is of utmost importance, as it prevents any script execution.<\/p>\n
AllSigned<\/strong>:<\/p>\nRequires that all scripts and configuration files be signed by a trusted publisher. Unsigned scripts won’t run. This policy is more flexible than Restricted but still maintains a high level of security.<\/p>\n
RemoteSigned<\/strong>:<\/p>\nRequires that all scripts and configuration files downloaded from the internet be signed by a trusted publisher. Locally created scripts don’t need to be signed. This policy balances security with convenience, allowing locally created scripts to run without requiring a signature but enforcing signature checks for scripts obtained from the internet.<\/p>\n
Unrestricted<\/strong>:<\/p>\nAllows all scripts and configuration files to run, regardless of origin or whether they’re signed. This policy prioritizes convenience over security and should be used with caution, as it opens up the system to potential risks from running unsigned or malicious scripts.<\/p>\n
Bypass<\/strong>:<\/p>\nAllows all scripts to run, regardless of signature. Unlike Unrestricted, Bypass still respects the system’s execution policy. This policy is useful for temporarily bypassing the execution policy when running scripts from trusted sources, but it should be used with caution to avoid unintended security vulnerabilities.<\/p>","upvoteCount":3,"datePublished":"2024-02-07T07:52:07.000Z","url":"https://community.spiceworks.com/t/how-to-run-powershell-script-as-nt-authority-system/966580/2","author":{"@type":"Person","name":"joeledwards","url":"https://community.spiceworks.com/u/joeledwards"}},{"@type":"Answer","text":"
If you want to run as system, then PSEXEC will do this for you<\/p>\n
How to: become the LOCAL SYSTEM account with PsExec - Specops Software<\/p>\n