Jump to content

Recommended Posts

Posted

I'm having trouble running the following portion of my script. The whole process involves two scripts: one Autoit, and one Dos BAT file.

$CD_ROM = drivegetdrive("CDROM")
runwait(@comspec & " /c " & $CD_ROM[1] & "\patchupdate.bat " & $CD_ROM[1])

The Autoit script finds the letter of the first CDROM Drive (from a laptop), because it may not always be D:. Then it passes the drive letter as the path and as a variable to the DOS batch file. The dos batch file then interprets the variable as %1 and uses it to continue it's operations.

Here is the structure of the CDROM.

[Root]

|_____PatchUpdate.bat

|_____PatchUpdate.EXE

|_____[DATA]

I know that the drivegetdrive("") function works as I have tried the following line with success in the same scripts.

msgbox(1,"CDROM Get","The letter of the CDrom drive is: " & $CD_ROM[1])

The error message that I get is attached.

Please Advise.

Thanks,

-Blademonkey

PS:sorry if this is a newbie question.

---"Educate the Mind, Make Savage the Body" -Mao Tse Tung

Posted (edited)

Check the output line and compare it. See if there some mistake in this line, with the path.

MsgBox(0, "Output test", $CD_ROM[1] & "\patchupdate.bat " & $CD_ROM[1] )

edit: typos

<{POST_SNAPBACK}>

I tried it and it gave me the line "d:\patchupdate.bat d:"

There's a couple things I didnt mention before, the script that I posted is only a portion of the script file. Here is the whole script file below:

$password = "*******"

$CD_ROM = drivegetdrive("CDROM")

$netcon = drivegetdrive("NETWORK")

$initialTime = "30"

; ----------------------------------------------------------------------------

; Script Start

; ----------------------------------------------------------------------------

;---> Check OS Version <---

If @OSVersion <> "WIN_XP" then

msgbox(1,"Windows Version","Invalid version of Windows")

Exit

EndIf

;---> Map to Network Share and run patch installation <---

DriveMapAdd("g:", "\\dcpcssrv5\scm_files")

;---> RunAs Network adminstrator account

RunAsSet("localaccount", @computername, $password)

;---> Display Dialog Box <---

MsgBox ( 64, "Security Patch Update", "Updating Patches in Progress." & @CRLF & "This message will automatically close in " &$initialTime & " seconds", $initialTime)

;---> Test to see if the Drivegetdrive function works.<---

;msgbox(1,"CDROM Get","The letter of the CDrom drive is: " & $CD_ROM[1])

;---> Runs the patchupdate.bat and passes the drive letter to the batch file <---

runwait(@comspec & " /c " & $CD_ROM[1] & "\patchupdate.bat " & $CD_ROM[1])

;---> Reset user's permissions <---

RunAsSet()

;---> Runs the auditorlog on whoever is logged in. <---

runwait(@comspec & " /c " & $cd_rom & "\data\auditor.exe " & $cd_rom & "\data\auditor.tab " & "c:\ntmarker\" & @computername &".log")

;---> Copying log files to user's home drive <---

filecopy("c:\ntmarker\patchupdate.log", "g:\tools\autoit_scripts\auditor_clone\")

filecopy("c:\ntmarker\" & @computername & ".log", "g:\tools\autoit_scripts\auditor_clone\")

;---> Cleanup <---

Drivemapdel("g:")

Originally I had used a network admin account to do a runas. I think it may have something to do with the version of AUTOit that I have, because when I try to compile my old code, which is just a simple

$username = "localadmin"
$domain = @computername
$password = "********"
Runasset($username, $domain, $password )
runwait(@comspec & " /c " & "d:\patchupdate.bat")
MsgBox ( 0, "Patch Update Completed", "Your Computer has been updated" , 30 )
Runasset()

When I compile this now, it does not work, but the old compiles DO.

Update: Looks like it's has something to do with Windows XP. I can run the script fine on my Desktop PC, but it dies on the laptop.

Edited by blademonkey

---"Educate the Mind, Make Savage the Body" -Mao Tse Tung

Posted

Ok well I found what the problem was. It was a group policy setting.

Everything works. Thanks for your suggestions Josbe. I appreciate your willlingness to help.

-blademonkey

---"Educate the Mind, Make Savage the Body" -Mao Tse Tung

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...