Someone
public text v1 · immutable//Working VBS code
set SRP = GetObject("winmgmts:\\.\root\default:SystemRestore")
eSRP = SRP.enable("c:\\")
//Non-working PowerShell code
$sysresconf = Get-WmiObject -namespace root/default -class SystemRestore
echo $sysresconf
//no output returned..
PS C:\Users\Mike\Desktop> $sysresconf.Enable("C:\\")
You cannot call a method on a null-valued expression.
At line:1 char:19
+ $sysresconf.Enable( <<<< "C:\\")