Posted in

Obejście (Bypass) the PowerShell Execution Policy

Czasami musimy wykonać skrypt PowerShell mimo ustawienia Execution Policy na Restricted (ustawienie domyślne). W Internecie szybko znajdziemy strony typu „15 Ways to Bypass the PowerShell Execution Policy” lecz nie wszystkie metody działają. Dla mnie jedną z metod zawsze działających jest wykonanie:
type script.ps1 |powershell.exe -windowstyle hidden -noprofile –
lub w pliku bat, abyśmy nie widzieli za dużo na ekranie:
@echo off ::run_ps_script.bat type script.ps1 |powershell.exe -windowstyle hidden -noprofile –
Więcej informacji o wykonywaniu z pozoru niechcianego oprogramowania znajdziecie w moim kursie na Microsoft Virtual Academy – “Wykorzystanie narzędzi hackerskich do audytu środowiska informatycznego“.
Sometimes we have to run the PowerShell script despite the Execution Policy setting on Restricted (default). On the Internet, you will quickly find pages like “15 Ways to Bypass the PowerShell Execution Policy” but not all methods work. For me, one of the methods that are always working is to make:
type script.ps1 |powershell.exe -windowstyle hidden -noprofile –
or in a bat file so that we do not see too much on the screen:
@echo off :: run_ps_script.bat type script.ps1 | powershell.exe -windowstyle hidden -noprofile –
More information about performing seemingly unwanted software can be found in my course at the Microsoft Virtual Academy – “Using hack tools for the audit of the IT environment“.

Microsoft Certified Trainer, Office 365, AWS, Azure and Cloud Expert-Architect. In the IT world for over than 20 years.

Apart from the main area of Microsoft Azure expert in the field of infrastructure servers Windows Server 2003-2019, Microsoft Active Directory, Hyper-V Private Cloud, IIS, System Center, SQL.

Private Cloud, System Center, Hyper-V, Open Stack Expert and all Microsoft products Expert. Linux Server administrator.

My Azure community projects:

https://mazeball.azurewebsites.net/
https://github.com/MariuszFerdyn?tab=repositories

More