W00tever Posted April 22, 2009 Share Posted April 22, 2009 Hi all, new user to auto it and stumped. I've tried shellexecute, runwait comspec, and run comspec and constantly given can't find the path specified when including anything after the first command. dim $startdate dim $enddate dim $cmd dim $options dim $output $cmd = "certutil -config servername\CA 1 -view -restrict" $startdate = "NotAfter>=1/1/2009 08:00AM," $enddate = "NotAfter<=3/1/2009 08:00AM," $options = "commonname>=empty,request organization=myorg" $output = "-out commonname,certificate expiration date,requester name" Run(@ComSpec & " /k " & $cmd & $startdate & $enddate & $options & $output, "c:\windows\system32") here is the working command certutil -config "servername\CA 1" -view -restrict "NotAfter>=1/1/2009 08:00AM,NotAfter<=3/1/2009 08:00AM,commonname>=empty,request organization=myorg" -out "commonname,certificate expiration date,requester name" appreciate any pointers you could give me. Thanks! Link to comment Share on other sites More sharing options...
99ojo Posted April 22, 2009 Share Posted April 22, 2009 (edited) Hi all, new user to auto it and stumped. I've tried shellexecute, runwait comspec, and run comspec and constantly given can't find the path specified when including anything after the first command. dim $startdate dim $enddate dim $cmd dim $options dim $output $cmd = "certutil -config servername\CA 1 -view -restrict" $startdate = "NotAfter>=1/1/2009 08:00AM," $enddate = "NotAfter<=3/1/2009 08:00AM," $options = "commonname>=empty,request organization=myorg" $output = "-out commonname,certificate expiration date,requester name" Run(@ComSpec & " /k " & $cmd & $startdate & $enddate & $options & $output, "c:\windows\system32") here is the working command certutil -config "servername\CA 1" -view -restrict "NotAfter>=1/1/2009 08:00AM,NotAfter<=3/1/2009 08:00AM,commonname>=empty,request organization=myorg" -out "commonname,certificate expiration date,requester name" appreciate any pointers you could give me. Thanks!Hi, have a look on your working command. As result your Code should look like: $cmd = "certutil -config """ & "servername\CA 1""" & " -view -restrict " $startdate = """NotAfter>=1/1/2009 08:00AM," $enddate = "NotAfter<=3/1/2009 08:00AM," $options = "commonname>=empty,request organization=myorg """ $output = " -out """ & "commonname,certificate expiration date,requester name""" MsgBox (0,"",$cmd & $startdate & $enddate & $options & $output) ; 4 controloutput of running command ;Run(@ComSpec & " /k " & $cmd & $startdate & $enddate & $options & $output, "c:\windows\system32") you may have to alter the variables because of ". Therefore you can use the MsgBox ;-)) Stefan Edited April 22, 2009 by 99ojo Link to comment Share on other sites More sharing options...
Juvigy Posted April 22, 2009 Share Posted April 22, 2009 Isnt that RunWait(@COMSPEC & " /c and not RunWait(@COMSPEC & " /k ???? Link to comment Share on other sites More sharing options...
W00tever Posted April 22, 2009 Author Share Posted April 22, 2009 Hi, have a look on your working command. As result your Code should look like: $cmd = "certutil -config """ & "servername\CA 1""" & " -view -restrict " $startdate = """NotAfter>=1/1/2009 08:00AM," $enddate = "NotAfter<=3/1/2009 08:00AM," $options = "commonname>=empty,request organization=myorg """ $output = " -out """ & "commonname,certificate expiration date,requester name""" MsgBox (0,"",$cmd & $startdate & $enddate & $options & $output) ; 4 controloutput of running command ;Run(@ComSpec & " /k " & $cmd & $startdate & $enddate & $options & $output, "c:\windows\system32") you may have to alter the variables because of ". Therefore you can use the MsgBox ;-)) Stefan Here is what I get. When run as is. C:\Windows\System32\scripts\autoit\new.au3(1,71) : ERROR: syntax error (illegal character) $cmd = "certutil -config """ & "servername\CA 1 -view -restrict " & """ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ C:\Windows\System32\scripts\autoit\new.au3 - 1 error(s), 0 warning(s) so I removed the last quote and the msgbox syntax looks perfect. Then when you run the actual it says The system cannot find the path specified. c:\windows\system32> I'm very confused now Link to comment Share on other sites More sharing options...
W00tever Posted April 22, 2009 Author Share Posted April 22, 2009 I got it! Thanks Stefan for pointing me in the right direction. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now