Advertisement
eudemonics

unzip sysinternals suite and create env path variable!

Apr 26th, 2014
201
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #DOWNLOAD SYSINTERNALS SUITE FROM HERE: http://download.sysinternals.com/files/SysinternalsSuite.zip
  2. #SAVE POWERSHELL SCRIPT AS "sysinternals.ps1"
  3. #PUT SCRIPT IN SAME DIRECTORY AS DOWNLOADED ZIP FILE
  4. #RUN POWERSHELL AS ADMINISTRATOR
  5. #IF POWERSHELL IS NOT ENABLED TO RUN UNSIGNED SCRIPTS, ENTER COMMAND "Set-ExecutionPolicy Unrestricted"
  6. #CHANGE DIRECTORY TO LOCATION OF SCRIPT AND ZIP FILE "cd C:\<download location>"
  7. #EXECUTE POWERSHELL SCRIPT WITH ".\sysinternals.ps1"
  8. #AFTER SCRIPT EXECUTION, RUN ANY SYSINTERNALS TOOL FROM ANY LOCATION! (type "procexp" into run or command prompt for example)
  9.  
  10. ####################################################################################################
  11.  
  12. $shell = new-object -com shell.application
  13.  
  14. #default filename as downloaded from Microsoft
  15. $sourceFile = "SysinternalsSuite.zip"
  16.  
  17. $fullFile = $shell.namespace((Get-Location).Path + "\$sourceFile")
  18.  
  19. #create sysinternals directory if doesn't exist
  20. if (!(test-path "C:\sysinternals")) {
  21.     mkdir C:\sysinternals
  22. }
  23. $destination = $shell.namespace("C:\sysinternals")
  24.  
  25. #unzip the files
  26. $destination.Copyhere($fullFile.items())
  27.  
  28. #put suite into environmental path variable
  29. [Environment]::SetEnvironmentVariable("Path",$Env:Path + ";C:\sysinternals", "Machine")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement