Created
February 4, 2020 12:48
-
-
Save jcefoli/e6014cf5e9f64d30a364fbdfa478a814 to your computer and use it in GitHub Desktop.
Pause Script When Run Locally But not Remotely
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Add to end of script | |
if ($PSSenderInfo) { | |
#Script was launched remotely. Do Not Pause | |
} | |
else { | |
#Script is running locally, pause | |
[void](Read-Host 'Press Enter to continue') | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment