As part of a much larger script I am trying to get some of the Local
security settings on a server using the DUMPSEC program. The program
resides on the local systemdrive of the server, though I would prefer
running it from the mapped drive where the script resides. In either
case my code does not run the program. If I run the command from the
command line the output file is created. When I run the following
code the script hangs and the output file is never created.

Set objShell = CreateObject("WScript.Shell")

strRunStmt = "%COMSPEC% c:\scripts\DUMPSEC.exe /rpt=POLICIES /
showaudit /saveas=CSV /outfile=c:\scripts\report.txt /noowner"

objShell.Run strRunStmt,,True

Can someone shed some light on what I am doing wrong here?

Thanks.

Re: DOS program does not run - Help please by Csaba

Csaba
Tue Nov 27 13:20:36 PST 2007

On Nov 27, 8:33 pm, Cmor <cmor17...@gmail.com> wrote:
> As part of a much larger script I am trying to get some of the Local
> security settings on a server using the DUMPSEC program. The program
> resides on the local systemdrive of the server, though I would prefer
> running it from the mapped drive where the script resides. In either
> case my code does not run the program. If I run the command from the
> command line the output file is created. When I run the following
> code the script hangs and the output file is never created.
>
> Set objShell = CreateObject("WScript.Shell")
>
> strRunStmt = "%COMSPEC% c:\scripts\DUMPSEC.exe /rpt=POLICIES /
> showaudit /saveas=CSV /outfile=c:\scripts\report.txt /noowner"
>
> objShell.Run strRunStmt,,True
>
> Can someone shed some light on what I am doing wrong here?
>
> Thanks.

I don't know what your specific problem is but I would insert a /K
into the strRunStmt so that you can see what's happening:
strRunStmt = "%COMSPEC% /K c:\...

Also, though it shouldn't matter, I'd use a 1 for the missing argument
on the objShell.Run line.

You can use the following mini script as a working template
(eventually change the /K to /C (to automatically exit the cmd
window. Otherwise you have to manually type exit) and the missing arg
to a 0 from 1 so that the cmd window doesn't flash you.

Set WshShell = CreateObject("Wscript.shell")
WshShell.Run "%comspec% dir", 1, true


Csaba Gabor from Vienna