Goal:
Reboot a remote (W7-client with PSv5) computer and notify the currently logged on user and show a countdown in minutes.
Restrictions:
only WMI or Registry ( Powershell Remoting will only work 90% of the time )
What I have tried to do:
I would like leverage the build in SCCM client functionality with give’s a nice user experience.
Only I got stuck at changing the WMI Properties.
This command (Methode) give’s the reboot Status:
$Status = Invoke-WmiMethod -Namespace "ROOT\ccm\ClientSDK" -Class CCM_ClientUtilities -Name DetermineIfRebootPending -EnableAllPrivileges
$Status
__GENUS : 1
__CLASS : __PARAMETERS
__SUPERCLASS :
__DYNASTY : __PARAMETERS
__RELPATH : __PARAMETERS
__PROPERTY_COUNT : 7
__DERIVATION : {}
__SERVER : MyPSComputer
__NAMESPACE : ROOT\ccm\ClientSDK
__PATH : \\ MyPSComputer\ROOT\ccm\ClientSDK:__PARAMETERS
DisableHideTime : 19700101010000.000000+000
InGracePeriod : False
IsHardRebootPending : False
NotifyUI : False
RebootDeadline : 19700101010000.000000+000
RebootPending : False
ReturnValue : 0
PSComputerName : MyPSComputer
I would like to Set the following settings:
$Status.IsHardRebootPending = $True
$Status.NotifyUI = $True
$Status.RebootDeadline = [System.Management.ManagementDateTimeConverter]::ToDmtfDateTime($(get-date).AddMinutes(15))
Only this Object those not have a .Put() Methode.
And seems I can use can’t use this either:
Set-WmiInstance -Namespace "ROOT\ccm\ClientSDK" -Class CCM_ClientUtilities -PutType UpdateOnly -EnableAllPrivileges -Arguments @{IsHardRebootPending = $True}
Other Options:
- Shutdown.exe Only the Balloon Icons sucks and user will miss it.
- Maybe the Windows Update Reboot Req Timer, only can find information about this option.
- Msg.exe only this is nice ether.
Any help would really be great!
And the Get-member info:
$Status | GM -Force
TypeName: System.Management.ManagementBaseObject#ROOT\ccm\ClientSDK\__PARAMETERS
Name MemberType Definition
---- ---------- ----------
PSComputerName AliasProperty PSComputerName = __SERVER
pstypenames CodeProperty System.Collections.ObjectModel.Collection`1[[System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]] pstypenames{get=PSTypeNames;}
psadapted MemberSet psadapted {__GENUS, __CLASS, __SUPERCLASS, __DYNASTY, __RELPATH, __PROPERTY_COUNT, __DERIVATION, __SERVER, __NAMESPACE, __PATH, DisableHideTime, InGracePeriod, IsHardRebootPending, Not...
psbase MemberSet psbase {Properties, SystemProperties, Qualifiers, ClassPath, Item, Site, Container, Dispose, Clone, get_Properties, get_SystemProperties, get_Qualifiers, get_ClassPath, get_Item, set_I...
psextended MemberSet psextended {PSComputerName}
psobject MemberSet psobject {Members, Properties, Methods, ImmediateBaseObject, BaseObject, TypeNames, get_Members, get_Properties, get_Methods, get_ImmediateBaseObject, get_BaseObject, get_TypeNames, To...
DisableHideTime Property string DisableHideTime {get;set;}
InGracePeriod Property bool InGracePeriod {get;set;}
IsHardRebootPending Property bool IsHardRebootPending {get;set;}
NotifyUI Property bool NotifyUI {get;set;}
RebootDeadline Property string RebootDeadline {get;set;}
RebootPending Property bool RebootPending {get;set;}
ReturnValue Property uint32 ReturnValue {get;set;}
__CLASS Property string __CLASS {get;set;}
__DERIVATION Property string[] __DERIVATION {get;set;}
__DYNASTY Property string __DYNASTY {get;set;}
__GENUS Property int __GENUS {get;set;}
__NAMESPACE Property string __NAMESPACE {get;set;}
__PATH Property string __PATH {get;set;}
__PROPERTY_COUNT Property int __PROPERTY_COUNT {get;set;}
__RELPATH Property string __RELPATH {get;set;}
__SERVER Property string __SERVER {get;set;}
__SUPERCLASS Property string __SUPERCLASS {get;set;}