Tutorial by Examples

#requires -version 4 After trying to run this script in lower version, you will see this error message .\script.ps1 : The script 'script.ps1' cannot be run because it contained a "#requires" statement at line 1 for Windows PowerShell version 5.0. The version required by the script do...
4.0 #requires -RunAsAdministrator After trying to run this script without admin privileges, you will see this error message .\script.ps1 : The script 'script.ps1' cannot be run because it contains a "#requires" statement for running as Administrator. The current Windows PowerShell s...

Page 1 of 1