Jump to content

ERROR ON RUNAS OVER VISTA


Recommended Posts

hI, I dont know the actual razon, but this script don't work in windows vista

#RequireAdmin
; Fill in the username and password appropriate for your system.
Local $sUserName = "jmfs"
Local $sPassword = "PmP123456"

; Run a command prompt as the other user.
;~ Local $pid = RunAsWait($sUserName, @ComputerName, $sPassword, 0, @ComSpec, @SystemDir)
Local $pid = RunAs($sUserName, @ComputerName, $sPassword, 0, 'CMD.EXE /C NET USE Z: \\SERVIDOR\PMP /PERSISTENT:NO',@SystemDir)
;~ Wait for the process to close.
ProcessWaitClose($pid)

; Show a message.
MsgBox(0, "", "The process we were waiting for has closed.")

if anybody can helpme, I will grateful,

PS: I tried other way cfuntion ex drivemapadd and wscrit, examples found on this forum and and none could map a drive

Link to comment
Share on other sites

Link to comment
Share on other sites

Hi there

Local $pid = RunAs($sUserName, @ComputerName, $sPassword, 0, 'CMD.EXE /C NET USE Z: \\SERVIDOR\PMP /PERSISTENT:NO',@SystemDir)

@Systemdir?

you can only use :

@SW_HIDE = Hidden window (or Default keyword)

@SW_MINIMIZE = Minimized window

@SW_MAXIMIZE = Maximized window

Try to use DriveMapAdd. If you do so you can manage errors!

Cheers

Edited by november

Old Scriptology

Visual Ping 1.8 - Mass Ping Program with export to txt delimited.

Desktop 2 RGB and YMCK - Pick a color in the desktop and get the RGB and YMCK code.

Desktop 2 RGB - Pick a color in the desktop and get the RGB code.

ShootIT 1.0 - Screen Capture full and partial screen

[font="'Arial Black';"]Remember Remember The Fifth of November.[/font]

Link to comment
Share on other sites

1) Try a /K instead of /C this way you can read the error on the command line.

2) Make sure the "Secondary Logon" service is running on the machine your running it from.

3) You could try logging on as the user you are doing the runas with.

Disconnect the Z: drive.

And just do a straight run, see if the drive maps that way.

-Kenny

Edited by ken82m

 "I believe that when we leave a place, part of it goes with us and part of us remains... Go anywhere, when it is quiet, and just listen.. After a while, you will hear the echoes of all our conversations, every thought and word we've exchanged.... Long after we are gone our voices will linger in these walls for as long as this place remains."

Link to comment
Share on other sites

@Systemdir?

you can only use :

@SW_HIDE = Hidden window (or Default keyword)

@SW_MINIMIZE = Minimized window

@SW_MAXIMIZE = Maximized window

Try to use DriveMapAdd. If you do so you can manage errors!

Cheers

He's got it right, the working directory is in that position, the display flag is the next one over.

-Kenny

Edited by ken82m

 "I believe that when we leave a place, part of it goes with us and part of us remains... Go anywhere, when it is quiet, and just listen.. After a while, you will hear the echoes of all our conversations, every thought and word we've exchanged.... Long after we are gone our voices will linger in these walls for as long as this place remains."

Link to comment
Share on other sites

He's got it right, the working directory is in that position, the display flag is the next one over.

-Kenny

Yeap :P He's right allright!

Thou i think if he use all in one script languange would be better... just my personal opinion!

Cheers

Old Scriptology

Visual Ping 1.8 - Mass Ping Program with export to txt delimited.

Desktop 2 RGB and YMCK - Pick a color in the desktop and get the RGB and YMCK code.

Desktop 2 RGB - Pick a color in the desktop and get the RGB code.

ShootIT 1.0 - Screen Capture full and partial screen

[font="'Arial Black';"]Remember Remember The Fifth of November.[/font]

Link to comment
Share on other sites

1) Try a /K instead of /C this way you can read the error on the command line.

2) Make sure the "Secondary Logon" service is running on the machine your running it from.

3) You could try logging on as the user you are doing the runas with.

Disconnect the Z: drive.

And just do a straight run, see if the drive maps that way.

-Kenny

Thanks, I use your recomendation and work only from DOS command line. well, and when I close DOS windows the Z: unit is deleted.

I think this windows vista make a different application layer. or anything similiar.

Otherway is use DRIVEMAPADD, but don´t work.

Any other option or what is my mistake?

Link to comment
Share on other sites

when you ran the autoit script with /K what error did you get?

What was the @error code from DriveMapAdd?

_____________________________________________

EDIT:

You could try turning off user account control: http://www.petri.co.il/disable_uac_in_windows_vista.htm

Though I don't believe it would cause you a problem with this. Unfortunately my laptop is on XP so I can't try it myself.

-Kenny

Edited by ken82m

 "I believe that when we leave a place, part of it goes with us and part of us remains... Go anywhere, when it is quiet, and just listen.. After a while, you will hear the echoes of all our conversations, every thought and word we've exchanged.... Long after we are gone our voices will linger in these walls for as long as this place remains."

Link to comment
Share on other sites

hold on I think I know what's happening.

Can you send me some more of your code? What are you trying to do after you get the drive mapped?

_____________________________________

Try this:

#RequireAdmin
; Fill in the username and password appropriate for your system.
Local $sUserName = "jmfs"
Local $sPassword = "PmP123456"
DriveMapDel("Z:")
$1 = DriveMapAdd("Z:", "\\SERVIDOR\PMP", 0, @ComputerName & "\" & $sUserName, $sPassword)
$2 = @error
MsgBox(0, "Return", $1)
MsgBox(0, "@error", $2)

If it doesn't work send me the codes you get from the message boxes.

-Kenny

Edited by ken82m

 "I believe that when we leave a place, part of it goes with us and part of us remains... Go anywhere, when it is quiet, and just listen.. After a while, you will hear the echoes of all our conversations, every thought and word we've exchanged.... Long after we are gone our voices will linger in these walls for as long as this place remains."

Link to comment
Share on other sites

hold on I think I know what's happening.

Can you send me some more of your code? What are you trying to do after you get the drive mapped?

that is all code, I think only make virtual drive to server files, that is all.

but this don't work.

I know!!!! I can do it in .bat or .cmd, but a like make in autoit.

Link to comment
Share on other sites

posted some code above, see if that works, or what results you get.

-Kenny

 "I believe that when we leave a place, part of it goes with us and part of us remains... Go anywhere, when it is quiet, and just listen.. After a while, you will hear the echoes of all our conversations, every thought and word we've exchanged.... Long after we are gone our voices will linger in these walls for as long as this place remains."

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...