EditDashboardDeviceInfo

This is a sample PowerShell script for EditDashboardDeviceInfo. You may need to modify it to fit your needs and environment.

Copy
function EditDashboardDeviceInfo {
    param (
            [Parameter(Mandatory=$true)] $UserName               # Dashboard username
            ,$Password                                           # Dashboard password will prompt
            ,[Parameter(Mandatory=$true)] $DashboardUrl          # Dashboard URL. Example: https://vault.example.com
            ,[parameter(Mandatory = $true)] [Guid] $DeviceID     # Device ID of the device to edit
            ,[parameter(Mandatory = $true)] [string] $Custom1    # Text for Custom 1 field. Add other device fields as needed.
        ) 
            if (!$Password -or ($Password -eq "*")) {
            $Password = [Runtime.InteropServices.Marshal]::PtrToStringAuto([Runtime.InteropServices.Marshal]::SecureStringToBSTR((read-host -assecurestring -Prompt "Enter the password for $UserName")))
        }
    
    # Load the WSDL
    $proxy = New-WebServiceProxy -Uri "$DashboardUrl/Dashboard/DashboardService.v.1.0.svc?WSDL" -Namespace "DashboardServiceReference" -Class "foo"

    #Create the web service reference
    [DashboardServiceReference.EditDashboardDeviceInfoResult] $result = $null
    [DashboardServiceReference.EditableDashboardDeviceInfo] $editableDeviceInfo = New-Object DashboardServiceReference.EditableDashboardDeviceInfo
    [DashboardServiceReference.CallingContext] $callingContext = New-Object DashboardServiceReference.CallingContext

    #Identify the device and field values to change. Add other device fields as needed. 
    $editableDeviceInfo.DeviceId = $DeviceID
    $editableDeviceInfo.Custom1 = $Custom1

    # Add the editable information to the input structure
    [DashboardServiceReference.EditDashboardDeviceInfoInput] $editInputData = New-Object DashboardServiceReference.EditDashboardDeviceInfoInput
    $editInputData.DeviceInfo = ($editableDeviceInfo)

    #Set up calling credentials
    $callingContext.ContextIdentity = $UserName
    $callingContext.AuthenticationToken = $Password
    $callingContext.TokenType = [DashboardServiceReference.AuthenticationTokenType]::Password
    $callingContext.TokenTypeSpecified = $true

    # Edit the device
    [DashboardServiceReference.ServiceResponse] $serviceResponse = $proxy.EditDashboardDeviceInfo($callingContext, $editInputData, [ref] $result)
    $result
}