CheckForDuplicatedDevice

Modified on Mon, 21 Sep at 3:09 PM

Checks whether another computer exists with a DisplayName that starts with the given substring, excluding the current computer. This can be used to check if a device with the given name exists before creating another one.

For ease of use, you need to import the Console-API-Module.

All documentation can also be seen in the API Module.

 


Parameter:Description:
uri


string, optional
the address for the web service to be called
e.g.: http://coreservername/five9sWS/five9sWS.asmx
pat

string, mandatory
the Personal Access Token is a credential used to authenticate with our service 
computerIdn  

integer, mandatory
The ID of the current computer to exclude from the search. Pass a negative value to exclude a non-existent computer.
substringToSearch 

string, mandatory
The substring to search for at the beginning of the DisplayName (e.g., "PC" will match "PC-001", "PC-LAB", etc.)
 
Result:



Get started with the following PowerShell:
Import-Module $PSScriptRoot\Console-API-Module.psm1 -Verbose -Force #you need to execute this line once, so that powershell can offer intelliSense support

# Arrange the parameters
$wsdlUrl = "http://coreserver/five9sWS.asmx?wsdl" # web service URL, you need to replace the 'coreserver' with your actual value
$pat = "879067F0F16_YourPatHere_024214A4"
$substringToSearch = "WinVM0815"
$computerIdn = -9999

# Action
Invoke-CheckForDuplicatedDevice -uri $wsdlUrl -pat $pat -computerIdn $computerIdn -substringToSearch $substringToSearch

The result from the request will either be a True or False.


Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article