-2

I trying to get a vbs to open "System properties protection" windows. Then run the Sendkeys command to Configure button. The script open the System Properties protection fine. But same its not getting the sendkeys sent to to. The echo box does popup. But, doesn't see to go to the configure button and open it. I hope someone out there can help me with it. It look like the script is not accessing the System Properties protection window.

 Option Explicit
 Dim WshShell:Set WshShell=CreateObject("Wscript.Shell")
 WshShell.run "systempropertiesprotection"
    Wscript.Sleep 1000
    WshShell.SendKeys ("{tab}")
    WshShell.SendKeys ("{tab}")
    WshShell.SendKeys ("{~}")
    Wscript.echo "Open"
Wscript.quit
Ňɏssa Pøngjǣrdenlarp
  • 38,411
  • 12
  • 59
  • 178
user2559533
  • 39
  • 1
  • 2
  • 8
  • 1
    What are you actually trying to accomplish? Disable system protection? Change maximum disk space used for system protection? Delete all restore points? There're proper ways to do that don't involve `SendKeys`. `SendKeys` is extremely unreliable. – Helen Jan 14 '17 at 17:32
  • @Helen the proper ways probably aren't accessible from where they are trying to run it, which makes me doubt they should be. – user692942 Jan 14 '17 at 19:25

1 Answers1

0

Try running your script from an administrative command prompt.

Running:

set s=createobject("wscript.shell")
s.run "systempropertiesprotection"
wscript.Sleep 500
s.sendkeys("{tab} 2")
s.sendkeys("{ }")

... works for me when launched in this way.

HelpingHand
  • 199
  • 1
  • 11