Advertisement
Kalidor_Vorlich

3

Dec 20th, 2024
8
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. # Run the check on the remote machine
  2. Invoke-Command -ComputerName $remoteComputer -ScriptBlock {
  3. param ($path, $key)
  4. if (Test-Path $path) {
  5. $versionValue = Get-ItemProperty -Path $path -Name $key -ErrorAction SilentlyContinue
  6. if ($versionValue) {
  7. Write-Output "TeamViewer Version on $env:COMPUTERNAME: $($versionValue.Version)"
  8. } else {
  9. Write-Output "The key '$key' does not exist in '$path' on $env:COMPUTERNAME."
  10. }
  11. } else {
  12. Write-Output "The registry path '$path' does not exist on $env:COMPUTERNAME."
  13. }
  14. } -ArgumentList $registryPath, $keyName
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement