Important Notice: On February 29th, this community was put into read-only mode. All existing posts will remain but customers are unable to add new posts or comment on existing. Please feel to join our Community Discord for any questions and discussions.

Create Custom Variable

Is it possible to create a custom variable using a system variable? I'm trying to parse out several IP addresses discovered during a network scan that I know to be Cisco phones. If I running the following PowerShell tool against them, and they return True, I know them to be phones:

invoke-webrequest http://$(Computer:Target) | select-string "SPA504G -quiet

I want to setup custom dynamic groups of targets that return true on the above command. Seems every time I try to create the variable, PDQ Inventory complains about a spcae, @ or $ being in the name. I've been following this blog post for help but I'm not getting very far.

Thanks.

0

Comments

1 comment
Date Votes
  • If I understand correctly, I think this would work:

    $CiscoPhone = Invoke-WebRequest http://$(Computer:Target) | Select-String "SPA504G" -Quiet
    if ( $CiscoPhone -eq $true ) {
    
        PDQInventory.exe UpdateCustomVariable -Name "Cisco Phone" -Value "$CiscoPhone"
    
    }
    
    0