Run registry is unable to run file placed in the key:
Created: 27 Jan 2011 | 7 comments
Hi,
during the development of my packeage, I created a key in HKLM\Software\Microsoft\Windows\CurrentVersion\Run to run a .vbs file upon restart.
My machine has Win 7 OS and it's a 64-bit machine. But it's not firing upon restart.
I even tried the same functionality by placing in HKLM\Software\WOW6432\Microsoft\Windows\CurrentVersion\Run. But even then its not firing.
When run manually the .vbs file is working fine.
Same file is working in Win 7 32-bit perfectly.
Kindly help.
Discussion Filed Under:
Comments
What does the vbscript
What does the vbscript do?
Does the script execute or just not perform what you want it to do?
the vbs file code is as follows: SEE_CHECK.vbs is the vbs file
On Error Resume Next
Dim objResult
Set objShell = CreateObject("WScript.Shell")
' Deleting the Run key which invoked this exe.
objShell.regDelete "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run\SEE_CHECK"
'Checking the Encryption Status
Drive = objShell.regRead("HKLM\SOFTWARE\Encryption Anywhere\Hard Disk\EAFS\Disk0\EncryptionInProgress")
If Drive = "" Then
objResult = objShell.Run("powercfg /Hibernate ON", 1, True)
Else
objShell.regWrite "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run\SEE_CHECK", "c:\program files\Configuration\SEE\SEE_CHECK.vbs"
End If
if Err.Number <> 0 then
' Re entering the Registry if any run time errors occurs. This exe will be run until the encryption compelte
objShell.regWrite "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run\SEE_CHECK", "c:\program files\Configuration\SEE\SEE_CHECK.vbs"
End IF
On Error Resume Next
Dim objResult
Set objShell = CreateObject("WScript.Shell")
' Deleting the Run key which invoked this exe.
objShell.regDelete "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run\SEE_CHECK"
'Checking the Encryption Status
Drive = objShell.regRead("HKLM\SOFTWARE\Encryption Anywhere\Hard Disk\EAFS\Disk0\EncryptionInProgress")
If Drive = "" Then
objResult = objShell.Run("powercfg /Hibernate ON", 1, True)
Else
objShell.regWrite "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run\SEE_CHECK", "c:\program files\Configuration\SEE\SEE_CHECK.vbs"
End If
if Err.Number <> 0 then
' Re entering the Registry if any run time errors occurs. This exe will be run until the encryption compelte
objShell.regWrite "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run\SEE_CHECK", "c:\program files\Configuration\SEE\SEE_CHECK.vbs"
End IF
-------------------------------------------------------
The .vbs file is not at all triggering on restart though it is placed in Run registry.
the vbs file code is as follows: SEE_CHECK.vbs is the vbs file
On Error Resume Next
Dim objResult
Set objShell = CreateObject("WScript.Shell")
' Deleting the Run key which invoked this exe.
objShell.regDelete "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run\SEE_CHECK"
'Checking the Encryption Status
Drive = objShell.regRead("HKLM\SOFTWARE\Encryption Anywhere\Hard Disk\EAFS\Disk0\EncryptionInProgress")
If Drive = "" Then
objResult = objShell.Run("powercfg /Hibernate ON", 1, True)
Else
objShell.regWrite "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run\SEE_CHECK", "c:\program files\Configuration\SEE\SEE_CHECK.vbs"
End If
if Err.Number <> 0 then
' Re entering the Registry if any run time errors occurs. This exe will be run until the encryption compelte
objShell.regWrite "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run\SEE_CHECK", "c:\program files\Configuration\SEE\SEE_CHECK.vbs"
End IF
On Error Resume Next
Dim objResult
Set objShell = CreateObject("WScript.Shell")
' Deleting the Run key which invoked this exe.
objShell.regDelete "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run\SEE_CHECK"
'Checking the Encryption Status
Drive = objShell.regRead("HKLM\SOFTWARE\Encryption Anywhere\Hard Disk\EAFS\Disk0\EncryptionInProgress")
If Drive = "" Then
objResult = objShell.Run("powercfg /Hibernate ON", 1, True)
Else
objShell.regWrite "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run\SEE_CHECK", "c:\program files\Configuration\SEE\SEE_CHECK.vbs"
End If
if Err.Number <> 0 then
' Re entering the Registry if any run time errors occurs. This exe will be run until the encryption compelte
objShell.regWrite "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run\SEE_CHECK", "c:\program files\Configuration\SEE\SEE_CHECK.vbs"
End IF
-------------------------------------------------------
The .vbs file is not at all triggering on restart though it is placed in Run registry.
Shouldn't you be referencing
Shouldn't you be referencing "C:\Program Files (x86)\Configuration\SEE\SEE_CHECK.vbs" on a 64bit system for a 32-bit file or did you set the package as 64-bit?
I tried in the C:\Program Files (x86)\Configuration\SEE\SEE_CHEC
I placed in this path "C:\Program Files (x86)\Configuration\SEE\SEE_CHECK.vbs" . Still, its not firing the vbs after restart. Same issue.
Kindly help.
what happens if you
what happens if you use:
cscript "C:\Program Files (x86)\Configuration\SEE\SEE_CHECK.vbs"
Have you tested to add the registry entry manually?
The RUN key needs to specify
The RUN key needs to specify an executable, and a VBS file is not an executable.
AngelD is correct - you need to call cscript.exe or wscript.exe as the executable, and pass the path to your VBS file as the argument. You will also need to update the VBS code to change the entry you make in the RUN key so that it includes the exe.
If your issue has been solved, please use the "Mark as Solution" link on the most relevant thread.
Would you like to reply?
Login or Register to post your comment.