powershellで復元ポイント作成

yyyymmddで名前つけて作成

checkpoint.ps1

$formatted_date = (Get-Date).ToString("yyyyMMdd");
CheckPoint-Computer -Description $formatted_date

vbsから実行するときは管理者権限つけてみよう

  • ExecutionPolicy も指定しないと実行できな環境もある
Set objWshShell = WScript.CreateObject("WScript.Shell") 
objWshShell.Run "powershell.exe -ExecutionPolicy RemoteSigned -File checkpoint.ps1 runas",0,1    '実行