serverRoom/amt-sdk-20-0-0-1/IntelvProModule/PS_Snippets/Network Admin/Set_Get Shared Static IP Settings.ps1

19 lines
1.1 KiB
PowerShell

# Select the wired interface.
$ethernetPortSettingsRef = $wsmanConnectionObject.NewReference("SELECT * FROM AMT_EthernetPortSettings WHERE InstanceID='Intel(r) AMT Ethernet Port Settings 0'")
$ethernetPortSettingsInstance = $ethernetPortSettingsRef.Get()
$dhcpEnabled = $ethernetPortSettingsInstance.GetProperty("DHCPEnabled")
$ipSyncEnabled = $ethernetPortSettingsInstance.GetProperty("IpSyncEnabled")
$sharedDynamicIP = $ethernetPortSettingsInstance.GetProperty("SharedDynamicIP")
$sharedStaticIP = $ethernetPortSettingsInstance.GetProperty("SharedStaticIp")
if($ipSyncEnabled -like "false")
{
$ethernetPortSettingsInstance = $ethernetPortSettingsInstance
$ethernetPortSettingsInstance.RemoveProperty("IPAddress")
$ethernetPortSettingsInstance.RemoveProperty("SubnetMask")
$ethernetPortSettingsInstance.RemoveProperty("DefaultGateway")
$ethernetPortSettingsInstance.RemoveProperty("PrimaryDNS")
$ethernetPortSettingsInstance.RemoveProperty("SecondaryDNS")
$ethernetPortSettingsInstance.SetProperty("DHCPEnabled","false")
$ethernetPortSettingsInstance.SetProperty("IpSyncEnabled","true")
$ethernetPortSettingsRef.Put($ethernetPortSettingsInstance)
}