Hello everyone. I need a vbs script to disable windows update scheduled task using Psexec.exe, which is located in the same directory as the vbs script. I need Psexec.exe as it is the only way for me to disable the task. Any other way I tried didn't work. Getting no permission or Access denied, using the administrator account.
Can do it by using command line script as below, but it is calling a console through another console, and can not hide Psexec.exe console window, which I don't want to be visible. It shows briefly and quits, but it is still visible.
%~dp0psexec.exe -i -d -s -accepteula schtasks /change /tn "Microsoft\Windows\WindowsUpdate\sihpostreboot" /disable
On the other hand I never could make Psexec disable that task through a vbs script at all, with
console window visible or not.
Can do it by using command line script as below, but it is calling a console through another console, and can not hide Psexec.exe console window, which I don't want to be visible. It shows briefly and quits, but it is still visible.
%~dp0psexec.exe -i -d -s -accepteula schtasks /change /tn "Microsoft\Windows\WindowsUpdate\sihpostreboot" /disable
On the other hand I never could make Psexec disable that task through a vbs script at all, with
console window visible or not.
Code:
Option Explicit
Dim fso
Dim GetTheParent
Dim vbhide
Set fso = CreateObject("Scripting.FileSystemObject")
GetTheParent = fso.GetParentFolderName(Wscript.ScriptFullName)
Dim objShell
Set objShell = Wscript.CreateObject("WScript.Shell")
objShell.Run GetTheParent & "\psexec.exe -i -d -s -accepteula schtasks /change /tn \Microsoft\Windows\WindowsUpdate\sihpostreboot /disable", vbhide