Jump to content

problem with administrativ share and fileactions..


memnon
 Share

Recommended Posts

Hi, i have problems to get following script to work, i want to get informations from a file on a server using administrative c$ share...

i always get "unable to open file .aitdump.ini"

i AM Domainadministrator and have full permissions to the file...

does autoit not support administrativ shares ?

#Include <process.au3>

$Aitdumpinicheck="\\server\c$\windows\aitdump.ini"

$file = FileOpen($Aitdumpinicheck, 0)

If $file = -1 Then

MsgBox(0, "Error", "Unable to open file. aitdump.ini")

Exit

EndIf

$dump = FileReadLine($file,1)

;Msgbox (0,"AIT Dump",$dump)

$dumppfad = FileReadLine($file,2)

;Msgbox (0,"AIT Dump",$dumppfad)

$copypfad = FileReadLine($file,3)

FileClose($file)

das beste Windows Support Forum: Windows 2000 Helpline und tschüss den WindowsfehlernProgrammieren: Autoit 3 - wer braucht noch VBS ?!Programmieren: Autoit 3 Forum?

Link to comment
Share on other sites

Hi, i have problems to get following script to work, i want to get informations from a file on a server using administrative c$ share...

i always get "unable to open file .aitdump.ini"

i AM Domainadministrator and have full permissions to the file...

does autoit not support administrativ shares ?

#Include <process.au3>

$Aitdumpinicheck="\\server\c$\windows\aitdump.ini"

$file = FileOpen($Aitdumpinicheck, 0)

If $file = -1 Then

    MsgBox(0, "Error", "Unable to open file. aitdump.ini")

    Exit

EndIf

$dump = FileReadLine($file,1)

;Msgbox (0,"AIT Dump",$dump)

$dumppfad = FileReadLine($file,2)

;Msgbox (0,"AIT Dump",$dumppfad)

$copypfad = FileReadLine($file,3)

FileClose($file)

<{POST_SNAPBACK}>

I tried a modified (used a different .ini file) version of your script and it worked fine for me. Make sure the aitdump.ini file exists on the server you are trying to access.
Link to comment
Share on other sites

I use a shared computer network on Windows Xp. I can access all areas of other computers except....

Windows, Program files and the "USER NAMES" under documents and settings, thus

for your application to work on my system i would need to move the file to a directory that i can access.

so... maybe try moving the file and see if it works first

just an idea

8)

Edited by Valuater

NEWHeader1.png

Link to comment
Share on other sites

Hi, i have problems to get following script to work, i want to get informations from a file on a server using administrative c$ share...

i always get "unable to open file .aitdump.ini"

i AM Domainadministrator and have full permissions to the file...

does autoit not support administrativ shares ?

#Include <process.au3>

$Aitdumpinicheck="\\server\c$\windows\aitdump.ini"

$file = FileOpen($Aitdumpinicheck, 0)

If $file = -1 Then

    MsgBox(0, "Error", "Unable to open file. aitdump.ini")

    Exit

EndIf

$dump = FileReadLine($file,1)

;Msgbox (0,"AIT Dump",$dump)

$dumppfad = FileReadLine($file,2)

;Msgbox (0,"AIT Dump",$dumppfad)

$copypfad = FileReadLine($file,3)

FileClose($file)

<{POST_SNAPBACK}>

it shouldn't matter, but rather than using fileopen with the variable, why don't you try using FileOpen with the literal string assigned to the variable. also you say you're using RunAsSet() to get required permissions, could you post that line too, with your name and password as x's or whatever so we don't have your info. the issue could be just a typo in the RunAsSet line...
Link to comment
Share on other sites

it shouldn't matter, but rather than using fileopen with the variable, why don't you try using FileOpen with the literal string assigned to the variable.  also you say you're using RunAsSet() to get required permissions, could you post that line too, with your name and password as x's or whatever so we don't have your info.  the issue could be just a typo in the RunAsSet line...

<{POST_SNAPBACK}>

the runasset options, does what it should, i create locally a file and that IS working with that, but its nor possible to create the file on the net, without giving the loggedon user rights to the share, the administrator (with runasset) HAS full permissions to the share AND the ntfs folder, if i log on AS the administrator i can create the file, if am logged on as user ic an only create the file locally using the runasset function.

i tried also to use the path directly in the fileopen dialog, without the variable

Edited by memnon

das beste Windows Support Forum: Windows 2000 Helpline und tschüss den WindowsfehlernProgrammieren: Autoit 3 - wer braucht noch VBS ?!Programmieren: Autoit 3 Forum?

Link to comment
Share on other sites

Silly questions, but good to know for troubleshooting:

1.) What is the OS you are using to access the server?

2.) What method? (Telnet, SSH, 3rd party app)

3.) What is the OS the server is using?

4.) Are you able to create/read/write other file types with Au3? (i.e. logs, text files, etc)

The reasons behind asking this are because I once had a similar problem where I was connecting to a linux server via a scriptable FTP application and I was unable to modify any file (though I was logged on as root admin) due to an OS conflict. How I solved it was to tell the server to change the file attributes before I tried to read/write/create/delete. Instead of doing it via FTP (where the FTP downloads a list of files and you can modify them on your computer and send them back) I sent commands via SSH Telnet and then modified them how I wanted.

-CMR

Link to comment
Share on other sites

Silly questions, but good to know for troubleshooting:

1.) What is the OS you are using to access the server?

2.) What method? (Telnet, SSH, 3rd party app)

3.) What is the OS the server is using?

4.) Are you able to create/read/write other file types with Au3? (i.e. logs, text files, etc)

-CMR

<{POST_SNAPBACK}>

1. xp sp2, firewall disabled

2. i createfile with autoit itself (FileCreate..)

3. windows 2003 sp1 with firewall disabled

4. shure i am but as i said, it seams, that it only works without ;) runasset

if i make scripts without runasset and logged on as admin, it does work on the same destination and source

das beste Windows Support Forum: Windows 2000 Helpline und tschüss den WindowsfehlernProgrammieren: Autoit 3 - wer braucht noch VBS ?!Programmieren: Autoit 3 Forum?

Link to comment
Share on other sites

if anyone could try....

make a script, what uses runasset and try to create a dir on a server´s administrativ c$ share (\\server\c$\"anydir")

log on as admin - it works

log on as normally user - it does not work

das beste Windows Support Forum: Windows 2000 Helpline und tschüss den WindowsfehlernProgrammieren: Autoit 3 - wer braucht noch VBS ?!Programmieren: Autoit 3 Forum?

Link to comment
Share on other sites

if anyone could try....

make a script, what uses runasset and try to create a dir on a server´s administrativ c$ share (\\server\c$\"anydir")

log on as admin - it works

log on as normally user - it does not work

<{POST_SNAPBACK}>

Reading at the help file runasset only work for the RUN and RUNWAIT functions

I will try this, I haven't test it I don't have a domain or network at home...

#include <file.au3>

$MakeFolder="\\server\c$\anydir"

RunAsSet ("user", "domain", "password")

RunWait(@ComSpec & " /c " & "md " & $MakeFolder)

RunAsSet()

$Aitdumpinicheck= $MakeFolder & "\aitdump.ini"

_FileCreate ($Aitdumpinicheck)

$file = FileOpen($Aitdumpinicheck, 0)

If $file = -1 Then

MsgBox(0, "Error", "Unable to open file. aitdump.ini")

Exit

EndIf

$dump = FileReadLine($file,1)

;Msgbox (0,"AIT Dump",$dump)

$dumppfad = FileReadLine($file,2)

;Msgbox (0,"AIT Dump",$dumppfad)

$copypfad = FileReadLine($file,3)

FileClose($file)

Note: For testing the idea I open CMD on my computer and ran this:

md \\%computername%\c$\anydir

for my surprise it create a folder called anydir.

Without having a network to test I assume the above script should work...

Edited by Danny35d
AutoIt Scripts:NetPrinter - Network Printer UtilityRobocopyGUI - GUI interface for M$ robocopy command line
Link to comment
Share on other sites

A couple of questions that might be helpful:

1. Is the script started on the client or the server?

2. If started from the server, are you logged in with your user account?

3. Is the user account the same, including password and administrative privileges, the same for both client and server.

4. Without using AutoIT or another application, can you execute \\{WorkstationName}/C$, via the windows run command, and navigate the system?

5. Are you in an AD network?

Link to comment
Share on other sites

A couple of questions that might be helpful:

1.  Is the script started on the client or the server?

2.  If started from the server, are you logged in with your user account?

3.  Is the user account the same, including password and administrative privileges, the same for both client and server. 

4.  Without using AutoIT or another application, can you execute \\{WorkstationName}/C$,  via the windows run command, and navigate the system?

5.  Are you in an AD network?

<{POST_SNAPBACK}>

1. client

4. yes

5. yes

as i told ya, althing works right, if i dont use runasset, create the script for admin account and start it as admin....

das beste Windows Support Forum: Windows 2000 Helpline und tschüss den WindowsfehlernProgrammieren: Autoit 3 - wer braucht noch VBS ?!Programmieren: Autoit 3 Forum?

Link to comment
Share on other sites

Double check the "Secondary Logon" or the "Run As" service is not set to disabled, stopped, or manual on the server.

1. Create a second script containing only the code that is needed to be executed on the server and compile it. Let's call this "part B" for clarity.

2. Mod you existing code right after the first RunAsSet() with only RunWait("part B"). I'd follow up with a MsgBox() for debugging purposes after that.

Also, you might try RunAsSet() with either a "0" or "2" option. I have a couple of scripts a execute under my user account permissions that needs the "2" instead of the default "1".

Edited by PerryRaptor
Link to comment
Share on other sites

1. client

4. yes

5. yes

as i told ya, althing works right, if i dont use runasset, create the script for admin account and start it as admin....

<{POST_SNAPBACK}>

As said ealier, RunAsSet is designed to work with Run and RunWait only.

What you need to do is connect to your remote share with your admin account using DriveMapAdd first.

DriveMapAdd("", "\\server\c$", 0, "domain\administrator", "password")

Don't forget to disconnect when you finish.

DriveMapDel("\\server\c$")
Link to comment
Share on other sites

As said ealier, RunAsSet is designed to work with Run and RunWait only.

What you need to do is connect to your remote share with your admin account using DriveMapAdd first.

DriveMapAdd("", "\\server\c$", 0, "domain\administrator", "password")

Don't forget to disconnect when you finish.

DriveMapDel("\\server\c$")

<{POST_SNAPBACK}>

i will try that, thx

das beste Windows Support Forum: Windows 2000 Helpline und tschüss den WindowsfehlernProgrammieren: Autoit 3 - wer braucht noch VBS ?!Programmieren: Autoit 3 Forum?

Link to comment
Share on other sites

  • 8 months later...

i will try that, thx

It's easier if you just call out the autoit script from another autoit script that instantiates the runas.

if you Autoit script #1 has the functions you want to run as an admin, compile it and create another autoit script #2 that will do a runwait("\\path\share\autoit script #1) in between a runasset function.

or you could try to do the impersonate script that Sumtingwong wrote, which works but is mighty complicated for us simpletons:

http://www.autoitscript.com/forum/index.ph...&hl=impersonate

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

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