Update TeamViewer IDs

Comments

1 comment

  • Thomas Lockyer

    Okay, so I ended up following some advice from Ryan Joachim from Reddit and running it as a tool/deployment instead, which works great.

    Code is below for anyone interested. It basically scans the target machine, grabs the TeamViewer ID from the registry then invokes the server to update the custom field in PDQ Inventory.

    [CmdletBinding()]
    param (
    [ValidateNotNullOrEmpty()]
    [string]
    $ServerHostName = "hostname",

    [ValidateNotNullOrEmpty()]
    [string]
    $CustomFieldName = "TeamViewer ID"
    )

    $GetID = (Get-ItemProperty "HKLM:\SOFTWARE\WOW6432Node\TeamViewer").ClientID

    [array]$CustomInfo = "Computer Name,$CustomFieldName"

    $CustomInfo += "$env:COMPUTERNAME,$GetID"

    Invoke-Command -ComputerName $ServerHostName -ScriptBlock {
    $TempFile = New-TemporaryFile
    $Using:CustomInfo | Out-File $TempFile
    PDQInventory ImportCustomFields -FileName $TempFile.FullName -AllowOverwrite
    }
    2
    Comment actions Permalink

Please sign in to leave a comment.