Sysinternals applications do not need to be installed, they can be copied to a USB drive and they will work well. The only inconvenience is that when running them from the command prompt or from PowerShell, that the current open directory will need to be the one containing the Sysinternal tools or the whole path to the Sysinternal tool will need to by typed. For example assume that Sysinternals tools are in C:\Program Files\SysinternalsSuite, and that we want to run PSInfo on the current computer. To do this we would need to type:
As can be observed typing the whole path is time consuming if constantly using tools from Sysinternals. A work around to not type the complete path is to add the SysinternalsSuite folder to the Windows Environmental variable called "Path".
This can be easily done through the Windows GUI, but if needed to do it on multiple computers a script will make it much more easier to do. The script I created to set up the "Path" variable is an extension of the script used to download Sysinternals, therefore the two functions will need to be in the same script or module.
The code is "As Is" I am not responsible for any bugs or problems it may create. I have been using it and I have not encounter any issues with it but it is the responsibility of the tech using the script to understand it and to be able to troubleshoot if any problems were to arise. Feel free to share and modify the code and make sure to provide a reference to my blog post.
Create a PowerShell script or module and copy the following code:
[String]$SysinternalsURL = 'https://live.sysinternals.com/',
[String]$Path = "$env:ProgramFiles\SysinternalsSuite"
If ((Test-Path -Path $Path) -ne $true)
Write-Verbose -Message "Downloading Sysinternals to $Path"
Get-Sysinternals -DownloadLocation $Path
If (($env:path.Contains("$Path") -ne $true ))
Write-Verbose -Message 'Adding path of Sysinternals to the $env:Path in Powershell'
$env:Path += ';' + "$Path"
Write-Verbose -Message 'Adding path of Sysinternals to the Windows Environment Variable'
[Environment]::SetEnvironmentVariable( "Path", $env:Path, [System.EnvironmentVariableTarget]::Machine )
Write-Verbose 'Sysinternals is done installing'
Computer Tech, interest in gaining a greater knowledge about most subjects, specially computer related.