Using PowerShell to test AMT - with scripts for Reason for last boot & Alarm Clock

Below find 2 scripts (Big Thanks to Lance A) using PowerShell* to:

  • Test the Reason for the last boot 
  • Set the AMT Alarm Clock.(legacy interface)

Before running a PowerShell script, you may need to set the PowerShell environment to allow scripts to run . Also make sure the vPro Scripting Library is installed on the client.

A PowerShell script template is available in the AMT SDK documentation online

These scripts were tested on Windows* 8.1 with  Intel AMT 9.5 with the WebUI set for Wireless.

The ReasonForBoot script can be used with the WebUI to confirm states after a shutdown/Power on or from Standby/PowerOn or combined with the Alarm Clock to verify an Alarm wake.


# Begin flow template
Import-Module 'IntelvPro'
########################################
#   Create a Wsman Connection Object   #
########################################
$wsmanConnectionObject = new-object 'Intel.Management.Wsman.WsmanConnection' 
$wsmanConnectionObject.Username = "admin"
$wsmanConnectionObject.Password = "P@ssw0rd"
$wsmanConnectionObject.Address = "http://" + "192.168.10.112" + ":16992/wsman"
########################################

$generalSettingsRef = $wsmanConnectionObject.NewReference("SELECT * FROM AMT_GeneralSettings WHERE InstanceID='Intel(r) AMT: General Settings'")
$generalSettingsInstance = $generalSettingsRef.Get( )
$hostName = $generalSettingsInstance.GetProperty("HostName")

$hostBootReasonRef = $wsmanConnectionObject.NewReference("SELECT * FROM IPS_HostBootReason WHERE InstanceID='Intel(r) AMT:Host Boot Reason'")
$hostBootReasonInstance = $hostBootReasonRef.Get()
$reason = $hostBootReasonInstance.GetProperty("Reason")
$reasonDetails = $hostBootReasonInstance.GetProperty("ReasonDetails")
$previousSxState = $hostBootReasonInstance.GetProperty("PreviousSxState")Write-Host "Last Boot reason is: $($reason.ToString())"
Write-Host "Reason details (if AMT): $($reasonDetails.ToString())"
Write-Host "Previous Sx state: $($previousSxState.ToString())"
########################################
Remove-Module 'IntelvPro'
# End flow template


# Begin flow template
Import-Module 'IntelvPro'
########################################
#   Create a Wsman Connection Object   #
########################################

$wsmanConnectionObject = new-object 'Intel.Management.Wsman.WsmanConnection' 
$wsmanConnectionObject.Username = "admin"
$wsmanConnectionObject.Password = "P@ssw0rd"
$wsmanConnectionObject.Address = "http://" + "192.168.10.112" + ":16992/wsman"
########################################
# Create the XML format of the NextAMTAlarmClock property.  

$nextAlarmTime = $wsmanConnectionObject.NewInstance("Datetime")
$nextAlarmTime.Text = "2014-07-17T19:30:00Z"
$alarmClockServiceRef = $wsmanConnectionObject.NewReference("SELECT * FROM AMT_AlarmClockService WHERE Name='Intel(r) AMT Alarm Clock Service'")
$alarmClockServiceInstance = $alarmClockServiceRef.Get()
$alarmClockServiceInstance.SetProperty("NextAMTAlarmTime", $nextAlarmTime)
$alarmClockServiceInstance.SetProperty("AMTAlarmClockInterval", $null)
$alarmClockServiceRef.Put($alarmClockServiceInstance)

 #Get and display the Alarm Clock Settings

$nextAMTAlarmTime = $alarmClockServiceInstance.GetProperty("NextAMTAlarmTime")
Write-Host "Alarm Clock setting is: $($nextAMTAlarmTime.InternalObject.Text)"
if($nextAMTAlarmTime.InternalObject.Text -ne $null)
{
    $amtAlarmClockInterval = $alarmClockServiceInstance.GetProperty("AMTAlarmClockInterval")
    Write-Host "Alarm Clock interval is: $($amtAlarmClockInterval.InternalObject.Text)"
}

########################################
Remove-Module 'IntelvPro'
# End flow template


 

Per informazioni complete sulle ottimizzazioni del compilatore, consultare l'Avviso sull'ottimizzazione