• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 854
  • Last Modified:

Login script won't start E-Z Audit scan in background. Why?

Okay here's the deal: I attempt to have a VBScript run an app called EZAudit on login. All the scanner does is compile all the computer information into a readable format using EZAudit, which is all done behind the scenes. The script calls a ezstart.exe file which uses ezscan.exe which is configured by the config file under the directory. I basically have told it to only wait 30 seconds (in the app...a sleep command in the VBscript doesn't help) before it initiates the scan for the test. I've tried a value of 0 as well, but no good.

Running the VBS file manually works great, and it dumps the file where I tell it to (a EZAudit filder on the network) so it's not the file path or script. It just won't start the executable when I try logging into the PC. Everything up to this point has worked when deploying the VBS file via Active Directory for a login for the last year. Nothing has changed! I went to delete the EZ9 files (they hold the computer information on a per computer basis) to manually initiate an audit across my network and after a few days I realized I had this problem. Now I've even upgraded to the new E-Z Audit 10 version, and it still doesn't run.

Did Microsoft release an update that disables EXE files from being called during the login process?

I have even tried changing the DFS name to the real file path name but to no avail. I know the script runs because I told it to do a message box for testing purposes. The ezscan.exe just doesn't load in the Processes. Any suggestions?
Here's the script: 
'************************************************************* 
'This script execute the EZStart software audit on client machines after user logon 
'************************************************************* 
 
Dim objShell, shellthis, shellcmd 
shellthis = "\\sc.local\clientroot\EZAudit\ezstart.exe" 
shellcmd = Chr(32) & "/auto" 
Set objShell = CreateObject("WScript.Shell") 
objShell.Run Chr(34) & shellthis & Chr(34) & shellcmd ,1,False 
Set objShell = Nothing

Open in new window

EZ.jpg
0
blanchard81
Asked:
blanchard81
  • 16
  • 13
  • 4
1 Solution
 
Jared LukerCommented:
Try setting your last perameter to true.  I'm thinking that your script is moving on without doing everything.
0
 
RobSampsonCommented:
That's really odd that you say running the VBS works fine, but as a "Login Script" it does not.  Can we just clarify that it is a Login Script, and not StartUp?

Anyway, try this, I'm just forcing a Command Prompt to attempt to run the EXE.....it might be that Windows is preventing the EXE from running from a network location.  Running Command Prompt first gets around that security issue....

Regards,

Rob.
Dim objShell, shellthis, shellcmd 
shellthis = "\\sc.local\clientroot\EZAudit\ezstart.exe" 
shellcmd = Chr(32) & "/auto" 
Set objShell = CreateObject("WScript.Shell") 
MsgBox "cmd /c " & Chr(34) & shellthis & Chr(34) & shellcmd
objShell.Run "cmd /c " & Chr(34) & shellthis & Chr(34) & shellcmd ,1,False 
Set objShell = Nothing

Open in new window

0
 
blanchard81Author Commented:
No that didn't work either. I just get the prompt (message box, no command prompt opens to run app visibly). I tried the message box deal to confirm it works before, and the script runs...just can't figure out why on earth it won't run the app.

I try to run it manually, and I do get the prompt and then the command prompt window pops open for a split second and then dissapears to allow the process start. ??? Wonder what gives here. I even changed the path to match the true UNC path behind the scenes so DFS does no work, but that doesn't even do anything either.

And yes, it is a login script via active directory. Any more ideas?
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
blanchard81Author Commented:
Raising the point value.
0
 
Jared LukerCommented:
The .run command is pretty cut and dry.  It obviously works because you can run it manually.

There is something about the state of the system that E-Z does not like at the time that you are trying to execute it.  How about putting it in a shutdown or logoff script so that you know the system is/should be in a state that could process the executable.
0
 
RobSampsonCommented:
You did mention that you tried a wait, but can we just try that again??

Rob.
Dim objShell, shellthis, shellcmd 
WScript.Wait 10000 ' wait 10 seconds
shellthis = "\\sc.local\clientroot\EZAudit\ezstart.exe" 
shellcmd = Chr(32) & "/auto" 
Set objShell = CreateObject("WScript.Shell") 
MsgBox "cmd /c " & Chr(34) & shellthis & Chr(34) & shellcmd
objShell.Run "cmd /c " & Chr(34) & shellthis & Chr(34) & shellcmd ,1,False 
Set objShell = Nothing

Open in new window

0
 
blanchard81Author Commented:
Now it gives me an error saying 'Object doesn't suppor thtis property or method 'WScript.Wait' and leaves the error code 800A01B6.

Okay so this went from, "Maybe I'm just dumb." to "This deserves more points!"

500, have at it.
0
 
Jared LukerCommented:
I belive that should be wscript.sleep and not wscript.wait.

That dissappoints me because I thought that Rob was perfect!  :)
0
 
blanchard81Author Commented:
Yeah, I should of caught that too. You'd think it would do the same thing. Um, no it did not work either. Really I'm fresh out of ideas here.
0
 
RobSampsonCommented:
Wow, that doesn't make sense!  Yeah, it was supposed to be WScript.Sleep, oops!

Anyway, what happens if we forget about E-Z Audit for a minute, and just see if it runs another program?

Rob.
Dim objShell, shellthis, shellcmd 
WScript.Wait 10000 ' wait 10 seconds
shellthis = "C:\Program Files\Microsoft Office\Office\Excel.exe" 
'shellcmd = Chr(32) & "/auto"
Set objShell = CreateObject("WScript.Shell") 
'MsgBox "cmd /c " & Chr(34) & shellthis & Chr(34) & shellcmd
'objShell.Run "cmd /c " & Chr(34) & shellthis & Chr(34) & shellcmd ,1,False 
MsgBox "cmd /c " & Chr(34) & shellthis & Chr(34)
objShell.Run "cmd /c " & Chr(34) & shellthis & Chr(34), 1, False 
Set objShell = Nothing

Open in new window

0
 
blanchard81Author Commented:
Nope...subsituted the Wait for Sleep and made sure it pointed to Office 11\Excel.exe, but all I get is the message box and nothing happens.
0
 
blanchard81Author Commented:
I'd like to point out that the Script is use in Acitive Directory and is in the same Login Script location as our Domain logon script. The main VBS file runs fine!
0
 
Jared LukerCommented:
Why don't you put an echo in there to make sure that the script is actually running?

Also, we might need some more information on how you are setting up the script.  Is it startup or login?  Is it GPO based, or are you just putting it in the %netlogon% share?
Dim objShell, shellthis, shellcmd 
wscript.echo "EZ Script Running"
WScript.Sleep 10000 ' wait 10 seconds
shellthis = "C:\Program Files\Microsoft Office\Office\Excel.exe" 
'shellcmd = Chr(32) & "/auto"
Set objShell = CreateObject("WScript.Shell") 
'MsgBox "cmd /c " & Chr(34) & shellthis & Chr(34) & shellcmd
'objShell.Run "cmd /c " & Chr(34) & shellthis & Chr(34) & shellcmd ,1,False 
MsgBox "cmd /c " & Chr(34) & shellthis & Chr(34)
objShell.Run "cmd /c " & Chr(34) & shellthis & Chr(34), 1, False 
Set objShell = Nothing

Open in new window

0
 
blanchard81Author Commented:
That won't do any good though. Because of the message box, I know the script runs. The login script runs as a part of a Group Policy. Our primary script that maps network drives is a part of the same group, as it applies to everyone.

0
 
RobSampsonCommented:
If you run the code below manually, you will see Notepad appear.  What happens if you run this as a login script?

Rob.
MsgBox "Waiting 10 seconds..."
WScript.Sleep 10000 ' wait 10 seconds
Set objShell = CreateObject("WScript.Shell") 
strCommand = "Notepad"
MsgBox "About to run " strCommand
objShell.Run strCommand, 1, False 
MsgBox strCommand & " has now finished."
Set objShell = Nothing

Open in new window

0
 
blanchard81Author Commented:
I get this. Doesn't run notepad at all when I run it manually either. I added the 'Dim objShell, shellthis, shellcmd' to the top of the line as well.

Doesn't work either way.
0
 
blanchard81Author Commented:
Sorry, let's see if it adds it this time.
New-Error.jpg
0
 
RobSampsonCommented:
Oh man! I've been coding messy lately!  Sorry!  I missed an ampersand symbol!

Rob.
MsgBox "Waiting 10 seconds..."
WScript.Sleep 10000 ' wait 10 seconds
Set objShell = CreateObject("WScript.Shell") 
strCommand = "Notepad"
MsgBox "About to run " & strCommand
objShell.Run strCommand, 1, False 
MsgBox strCommand & " should have now been run."
Set objShell = Nothing

Open in new window

0
 
blanchard81Author Commented:
It runs notepad!! How do you think I should repoint it to the EZ Audit software?
0
 
RobSampsonCommented:
Well, that's good new, but still strange that EZ Audit didn't work, try this:

Regards,

Rob
MsgBox "Waiting 10 seconds..."
WScript.Sleep 10000 ' wait 10 seconds
Set objShell = CreateObject("WScript.Shell") 
strCommand = "\\sc.local\clientroot\EZAudit\ezstart.exe /auto" 
MsgBox "About to run " & strCommand
objShell.Run strCommand, 1, False 
MsgBox strCommand & " should have now been run."
Set objShell = Nothing

Open in new window

0
 
RobSampsonCommented:
Or this.  Again, try these both manually, and as a Login script.

If they don't work, as another test, launch a Command Prompt, then paste this:
\\sc.local\clientroot\EZAudit\ezstart.exe /auto

and see if you get any error message or something.

Rob.
MsgBox "Waiting 10 seconds..."
WScript.Sleep 10000 ' wait 10 seconds
Set objShell = CreateObject("WScript.Shell") 
strCommand = "cmd /c \\sc.local\clientroot\EZAudit\ezstart.exe /auto" 
MsgBox "About to run " & strCommand
objShell.Run strCommand, 1, False 
MsgBox strCommand & " should have now been run."
Set objShell = Nothing

Open in new window

0
 
blanchard81Author Commented:
Nah, it's not working. Even the tech support at E-Z Audit are no help. It seems that that SLEEP command holds up the login process...could it be that it has to be fully logged in to initiate? It seems to run fine when I run it manually.
0
 
blanchard81Author Commented:
What if I scripted it to run/create a new scheduled task item? Would that be to hard (or even possible)? At least then I could tell it to run as a administrator. Just a thought. Thanks for the help.
0
 
RobSampsonCommented:
We could try that....run this manually, to see if it creates a scheduled task to run 10 minutes from now.

Regards,

Rob.
Set objNetwork = CreateObject("WScript.Network")
Set objShell = CreateObject("WScript.Shell")
strCommand = "\\sc.local\clientroot\EZAudit\ezstart.exe /auto"
intMinutesToAdd = 10
dteLater = DateAdd("n", intMinutesToAdd, Now)
If Hour(dteLater) > 12 Then
	strLater = Hour(dteLater) - 12 & ":" & Right("0" & Minute(dteLater), 2) & "PM"
Else
	strLater = Hour(dteLater) & ":" & Right("0" & Minute(dteLater), 2) & "AM"
End If
strCommand = "AT \\" & objNetwork.ComputerName & " " & strLater & " /INTERACTIVE """ & strCommand & """"
objShell.Run strCommand, 0, False

Open in new window

0
 
blanchard81Author Commented:
Well it created it but it was waiting to see if it was Idle to run. I'd prefer it to run no matter what, once a week. I can configure the rest behind the scenes in the config file to run whether there is an Audit file already present, how long it has been since it last run, stuff like that.

Would you be so kind as to script it to make sure it runs no matter what every week? No doubt you are good at what you do, because that's some crazy scripting to write a task! Thanks!
0
 
RobSampsonCommented:
Hmmm, that's odd....when I use this, it does not have any of the idle options set......the AT command does not seem to allow for the configuration of those options....

Rob.
0
 
RobSampsonCommented:
Oh, but we can make it run every Monday, by changing this:
strCommand = "AT \\" & objNetwork.ComputerName & " " & strLater & " /INTERACTIVE """ & strCommand & """"

to this
strCommand = "AT \\" & objNetwork.ComputerName & " " & strLater & " /every:M /INTERACTIVE """ & strCommand & """"

and the M is for Monday, other available options are
T,W,Th,F

Rob.
0
 
blanchard81Author Commented:
Thanks, this works really well, but could you tell me how to add user credentials? I think the entire problem is that it won't run as a administrator, and it'll fail to even start. I tested this by manually creating the same task, telling it to run within a minute, and adding the "/auto" switch to the end of it. It ran perfectly fine...given my user credentials as an admin on that machine. Works fine in XP. The idle thing was in Vista...ignore that comment.

It's always permissions. Thanks!
0
 
blanchard81Author Commented:
Actually, is there a %currentuser% command syntax or something? That would work better since all the users are logged into the domain seperately, yet they all should be administrators to the local machines. Thanks.
0
 
RobSampsonCommented:
Hi, using the current method, unfortunately no.  When the AT command is used, it always uses the local System account, and that cannot be changed....

I'll have to look into another method for creating scheduled tasks....

Rob.
0
 
RobSampsonCommented:
Hi, I cannot find any way to create a scheduled task with a specific Run As parameter that is not "SYSTEM".  I beleive the reason for this is that the user password is required to be entered, and confirmed, at the GUI, and so would be a security risk if it were to be used in a command.

Rob.
0
 
blanchard81Author Commented:
Thanks anyways. I'll give you the points for being on top of it. I suppose I'll just run it manually on the machines. Thanks again.
0
 
RobSampsonCommented:
Good luck.

Thanks for the grade.

Rob.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 16
  • 13
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now