Jump to content

Scripting problem


Recommended Posts

Hi all,

I am really having a hard time here, I'm hoping you all can help. I wrote what I thought was a very simple script. All we're trying to do is roll out a new background graphic to all our desktops as part of our marketing campaign.

Of course, during test it worked fine - until some helpdesk idiot told me they had granted all my test accounts admin rights on all 10 test boxes - really great! As soon as admin rights are gone, the script bombs.

Here's my script:

$logo = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\logo", "new_logo")

if $logo = 1 then

exit

endif

RunAsSet("svc_appinstall", "ctnet", "eat@joes!!!", 1)

FileInstall ("c:\logo2\c&t.bmp", "c:\logo\", 1)

FileInstall ("c:\logo2\new_logo.reg", "c:\logo\", 1)

FileInstall ("c:\logo2\new_logo2.reg", "c:\logo\", 1)

RunWait("c:\regedit /s c:\logo\new_logo.reg")

RunAsSet()

RunWait("regedit /s c:\logo\new_logo2.reg")

Run("shutdown.exe -f -r -t 30")

exit

When this runs, I keep getting errors in a pop-up box saying:

RunWait("regedit /s c:\logo\new_logo2.reg")

Error: Unable to execute the external program.

The directory name is invalid.

I have no idea what directory its even talking about. The c:\logo folder exists, the compiled script launches from it! Path to c:\windows is defined as a normal user. I am literally about to throw my monitor out the window. Please help me!?!?

Link to comment
Share on other sites

I've made a few updates just based on using the Help file, and here's what it is now. Still not working....

$logo = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\logo", "new_logo")

if $logo = 1 then

exit

endif

RunAsSet("svc_appinstall", "ctnet", "eat@joes!!!", 0)

FileInstall ("c:\logo2\c&t.bmp", "c:\logo\", 1)

FileInstall ("c:\logo2\new_logo.reg", "c:\logo\", 1)

FileInstall ("c:\logo2\new_logo2.reg", "c:\logo\", 1)

RunWait(@ComSpec & " /c " & "regedit.exe /s c:\logo\new_logo2.reg", "c:\windows")

RunAsSet()

RunWait(@ComSpec & " /c " & "regedit.exe /s c:\logo\new_logo2.reg", "c:\windows")

RunAsSet("svc_appinstall", "ctnet", "eat@joes!!!", 1)

Run(@ComSpec & " /c " & "shutdown.exe -f -r -t 30", "c:\windows")

RunAsSet()

exit

Link to comment
Share on other sites

More than likely, it's like it is here, if not and admin account can't access regedit

Try that line before resetting the run as set.

<{POST_SNAPBACK}>

The first "regedit" command fails, which is before the RunAsSet (), so it should run in the context of the administrative user, right?

Thank you all for the ideas... I am dying here, I'm glad there are people who are so helpful on here though!

Link to comment
Share on other sites

Need more info:

OS and SP

Also check to see if the fileinstall is actually installing files, i.e. do they exist where you expect them to. the runasset only works for run,runwait commands.

Edited by gafrost

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Link to comment
Share on other sites

Need more info:

OS and SP

Also check to see if the fileinstall is actually installing files, i.e. do they exist where you expect them to.  the runasset only works for run,runwait commands.

<{POST_SNAPBACK}>

I apologize - that is helpful info, isn't it!

Windows XP SP2.

The files to make it, however I would guess that it only makes it where I want them to with admin rights. I think I know where to take this.... I'll make a batch file run to copy the files necessary. Lemme see how that works...

Link to comment
Share on other sites

I apologize - that is helpful info, isn't it!

Windows XP SP2.

The files to make it, however I would guess that it only makes it where I want them to with admin rights. I think I know where to take this.... I'll make a batch file run to copy the files necessary. Lemme see how that works...

<{POST_SNAPBACK}>

Actually, after trying to do the copying in a batch file, I see that the files actually do not make it where I want them. With the FileInstall command they do, but that was when I was testing (mistakenly) with the admin user.

I keep getting access denied.

Link to comment
Share on other sites

So here's where I'm at now... I made a batch file that's supposed to do these file copies to the C:\windows folder under the administrative user context, but it doesn't seem to want to run under that context. The file is "new_logo.bat".

$logo = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\logo", "new_logo")

if $logo = 1 then

exit

endif

RunAsSet("svc_appinstall", "ctnet", "eat@joes!!!", 1)

RunWait('\\cle01chrtmbf01b\share\public\logo\new_logo.bat')

RunWait('regedit.exe /s "c:\windows\new_logo.reg"')

RunAsSet()

RunWait('regedit.exe /s "c:\windows\new_logo2.reg"')

RunAsSet("svc_appinstall", "ctnet", "eat@joes!!!", 1)

Run("shutdown.exe -f -r -t 0")

RunAsSet()

exit

Link to comment
Share on other sites

So here's where I'm at now... I made a batch file that's supposed to do these file copies to the C:\windows folder under the administrative user context, but it doesn't seem to want to run under that context. The file is "new_logo.bat".

$logo = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\logo", "new_logo")

if $logo = 1 then

  exit

endif

RunAsSet("svc_appinstall", "ctnet", "eat@joes!!!", 1)

  RunWait('\\cle01chrtmbf01b\share\public\logo\new_logo.bat')

  RunWait('regedit.exe /s "c:\windows\new_logo.reg"')

RunAsSet()

  RunWait('regedit.exe /s "c:\windows\new_logo2.reg"')

RunAsSet("svc_appinstall", "ctnet", "eat@joes!!!", 1)

  Run("shutdown.exe -f -r -t 0")

RunAsSet()

exit

<{POST_SNAPBACK}>

Sorry, forgot to state my problem. :( It's a really bad day today guys and dolls. Argh!!!

Anyway, I get the same error as before on that new batch file:

RunWait('cle01chrtmbf01b\share\public\logo\new_logo.bat')

Error: Unable to execute the external program.

The directory name is invalid.

Link to comment
Share on other sites

Sorry, forgot to state my problem. :( It's a really bad day today guys and dolls.  Argh!!!

Anyway, I get the same error as before on that new batch file:

RunWait('cle01chrtmbf01b\share\public\logo\new_logo.bat')

Error: Unable to execute the external program.

The directory name is invalid.

<{POST_SNAPBACK}>

might try adding the 2 backslashes on the beginning of the UNC path

I would try this in script 1

$logo = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\logo", "new_logo")
if $logo = 1 then
exit
endif

RunAsSet("svc_appinstall", "ctnet", "eat@joes!!!", 1)
RunWait("setlogo.exe")
RunAsSet()

script 2 "setlogo"

RunWait('\\cle01chrtmbf01b\share\public\logo\new_logo.bat')
RunWait('regedit.exe /s "c:\windows\new_logo.reg"')
RunWait('regedit.exe /s "c:\windows\new_logo2.reg"')
Run("shutdown.exe -f -r -t 0")
Edited by gafrost

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Link to comment
Share on other sites

That's a fantastic idea - I think it'll get me there. Since I am running the 2nd EXE inside admin context, I put back the FileInstall commands since that seems the cleanest.

Here's setlogo2.exe

FileInstall ("c:\logo2\c&t.bmp", "c:\windows\", 1)

FileInstall ("c:\logo2\new_logo.reg", "c:\windows\", 1)

FileInstall ("c:\logo2\new_logo2.reg", "c:\windows\", 1)

RunWait("regedit.exe /s c:\windows\new_logo.reg")

RunWait("regedit.exe /s c:\windows\new_logo2.reg")

Run("shutdown.exe -f -r -t 30")

But for some reason, these files don't copy. Almost like the 1st one isn't sending the user context over to this EXE. But I see DOS boxes open and close real quick, so I'm guessing its trying to launch.

Link to comment
Share on other sites

Being your running XP SP2 might want to check the event log and see if it's trying to elevate privalages

<{POST_SNAPBACK}>

Yeah I can see in the security log that the svc_appinstall account is trying to run things, I even see the shutdown process, but it says its exiting. Meaning it executed and is done, I guess. but still, there doesn't seem to be any sign of this thing trying to launch, other than that.
Link to comment
Share on other sites

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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...