Solved

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

Posted on 2008-06-11
33
790 Views
Last Modified: 2012-06-21
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
Comment
Question by:blanchard81
  • 16
  • 13
  • 4
33 Comments
 
LVL 17

Expert Comment

by:Jared Luker
Comment Utility
Try setting your last perameter to true.  I'm thinking that your script is moving on without doing everything.
0
 
LVL 65

Expert Comment

by:RobSampson
Comment Utility
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
 

Author Comment

by:blanchard81
Comment Utility
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
 

Author Comment

by:blanchard81
Comment Utility
Raising the point value.
0
 
LVL 17

Expert Comment

by:Jared Luker
Comment Utility
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
 
LVL 65

Expert Comment

by:RobSampson
Comment Utility
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
 

Author Comment

by:blanchard81
Comment Utility
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
 
LVL 17

Expert Comment

by:Jared Luker
Comment Utility
I belive that should be wscript.sleep and not wscript.wait.

That dissappoints me because I thought that Rob was perfect!  :)
0
 

Author Comment

by:blanchard81
Comment Utility
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
 
LVL 65

Expert Comment

by:RobSampson
Comment Utility
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
 

Author Comment

by:blanchard81
Comment Utility
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
 

Author Comment

by:blanchard81
Comment Utility
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
 
LVL 17

Expert Comment

by:Jared Luker
Comment Utility
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
 

Author Comment

by:blanchard81
Comment Utility
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
 
LVL 65

Expert Comment

by:RobSampson
Comment Utility
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
 

Author Comment

by:blanchard81
Comment Utility
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
Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 

Author Comment

by:blanchard81
Comment Utility
Sorry, let's see if it adds it this time.
New-Error.jpg
0
 
LVL 65

Expert Comment

by:RobSampson
Comment Utility
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
 

Author Comment

by:blanchard81
Comment Utility
It runs notepad!! How do you think I should repoint it to the EZ Audit software?
0
 
LVL 65

Expert Comment

by:RobSampson
Comment Utility
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
 
LVL 65

Expert Comment

by:RobSampson
Comment Utility
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
 

Author Comment

by:blanchard81
Comment Utility
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
 

Author Comment

by:blanchard81
Comment Utility
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
 
LVL 65

Expert Comment

by:RobSampson
Comment Utility
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
 

Author Comment

by:blanchard81
Comment Utility
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
 
LVL 65

Expert Comment

by:RobSampson
Comment Utility
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
 
LVL 65

Expert Comment

by:RobSampson
Comment Utility
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
 

Author Comment

by:blanchard81
Comment Utility
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
 

Author Comment

by:blanchard81
Comment Utility
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
 
LVL 65

Expert Comment

by:RobSampson
Comment Utility
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
 
LVL 65

Accepted Solution

by:
RobSampson earned 500 total points
Comment Utility
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
 

Author Closing Comment

by:blanchard81
Comment Utility
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
 
LVL 65

Expert Comment

by:RobSampson
Comment Utility
Good luck.

Thanks for the grade.

Rob.
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

This is an addendum to the following article: Acitve Directory based Outlook Signature (http://www.experts-exchange.com/Programming/Languages/Visual_Basic/VB_Script/Q_24950055.html) The script is fine, and works in normal client-server domains…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now