Quantcast
Channel: Windows PowerShell forum
Viewing all articles
Browse latest Browse all 21975

checking user privilages of account running script

$
0
0

   I have a powershell script that occasionally fails on systems that aren't running it with the correct account.

What I want to do is put a check at the beginning of the script to check that the user running the script has admin rights.

In Linux bash scripts I'd use something like this:

if [ "$(id -u)" != "0" ]; then

 I've run a few internet searches but I've not been able to find anything...
What is the powershell equivelant to this?

any help would be much appreciated


Viewing all articles
Browse latest Browse all 21975

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>