Got several times script running failed due to the ISE or PowerShell didn’t run as Administrator.

In order to make sure we are running the script as Administrator, we can use following script to test whether we are going to run this or not:

Enjoy Scripting~~