Page 1 of 1

Serial ID

Posted: Mon Apr 24, 2017 4:58 pm
by CameronWP
Hello:

I was wondering if there is a way to expose the serial ID of a device in Powershell. I haven't been able to find that functionality yet.

Thanks!

Re: Serial ID

Posted: Wed Apr 26, 2017 3:41 pm
by Ivan (staff)
Hello CameronWP,
You can try this PowerShell code:

Code: Select all

Import-Module StarWindX

$server = New-SWServer 127.0.0.1 3261 root starwind

try
{
    $server.Connect()

    if ( $server.Connected )
    {
       
        foreach($device in $server.Devices)
        {
            if ( $device.name -eq "ImageFile1" )
            {
                $device.GetPropertyValue("SerialId"); 
                break
            }
       
		}
	}	
    $server.Disconnect()
}
catch
{
    Write-Host "Exception $($_.Exception.Message)" -foreground red
    $server.Disconnect()
}
Where

Code: Select all

$server = New-SWServer 127.0.0.1 3261
you can type IP of this host

Code: Select all

if ( $device.name -eq "ImageFile1" )
type ImageFileX or HAImageX