Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Run the check on the remote machine
- Invoke-Command -ComputerName $remoteComputer -ScriptBlock {
- param ($path, $key)
- if (Test-Path $path) {
- $versionValue = Get-ItemProperty -Path $path -Name $key -ErrorAction SilentlyContinue
- if ($versionValue) {
- Write-Output "TeamViewer Version on $env:COMPUTERNAME: $($versionValue.Version)"
- } else {
- Write-Output "The key '$key' does not exist in '$path' on $env:COMPUTERNAME."
- }
- } else {
- Write-Output "The registry path '$path' does not exist on $env:COMPUTERNAME."
- }
- } -ArgumentList $registryPath, $keyName
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement