When people ask me what I do in my free time, this is the short answer. It’s a never ending story.

How to execute PowerShell scripts

If you have never ran a PS script on your computer, probably the default policy denies the execution. To allow scripts execution chose any option from below list which best fits for you. First start the PowerShell console with admin rights.

  1. Set-ExecutionPolicy – this command changes the default policy:
    Set-ExecutionPolicy Bypass
    Check the Microsoft’s article for more info: About Execution Policies
  2. Unblock-File – the Cmdlet is available since PowerShell version 3.0.
    Unblock-File -Path C:\MyScript.ps1
  3. Modify Data Stream – works for all file types.
    • Clear file stream preferences:
      cmd /c echo.> C:\MyScript.ps1:Zone.Identifier
    • Edit file stream preferences in notepad:
      notepad C:\MyScript.ps1:Zone.Identifier
  4. Execute script as string – If PS script execution is disabled on the system and you are not allowed to modify the policy, below command reads the file as a single line string, converts the content to a script block and execute it by call operator ‘&’
    & ([ScriptBlock]::Create((Get-Content C:\MyScript.ps1 | Out-String)))

Current Projects

  • SiRex – Get any system information from remote machine(s). Responsive GUI
  • UserInfo – Get user’s logon statistics
  • Lockouts – Get lockout location of a user or group of users
  • PS-Synth – Microtonal Piano Synthesizer. From 5-TET/EDO to 144-TET/EDO
  • PSRM – Agent-less monitoring tool. Relies on WinRM iver HTTPS and Task Scheduler
Notify of
Inline Feedbacks
View all comments