Archive | PowerShell RSS feed for this section

Tip : Is Your PowerShell Session Running With Administrative Privileges?

Sometimes you may need to perform administrative stuff within your script. In such cases, it’s better to check whether your user has such privileges to execute the script. Please find the sample below, which checks user for administrative privilege; $user = [Security.Principal.WindowsIdentity]::GetCurrent() if((New-Object Security.Principal.WindowsPrincipal $user).IsInRole([Security.Principal.WindowsBuiltinRole]::Administrator)){ # Keep executing your script… }else{ # Warn user for [...]

Read more
QR Code Business Card