Page 1 of 2 12>
Topic Options
#29903 - 2002-09-30 12:40 AM Copying files
Sverre Offline
Getting the hang of it

Registered: 2002-09-29
Posts: 52
I am copying certain files from the netlogon share to the local users harddisk, all of them work just fine except this one:

$dir=ReadValue("HKEY_LOCAL_MACHINE\software\microsoft\windows NT\currentversion", "SystemRoot")
Copy "%0\..\ls.bmp" $dir

What am I doing wrong here? All users have admin privileges on their local machine. If I run the script after the user is logged on it works fine.

Top
#29904 - 2002-09-29 02:37 PM Re: Copying files
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
the basic troubleshooting steps that I would employ are:

1) print the command to verify it looks proper. Add something like ? 'Copy "%0\..\ls.bmp" $dir' before the copy command.

2) Add '? @error @serror" after the COPY command to determine why the coomand is failing.
_________________________
Home page: http://www.kixhelp.com/hb/

Top
#29905 - 2002-09-29 02:50 PM Re: Copying files
Sverre Offline
Getting the hang of it

Registered: 2002-09-29
Posts: 52
The reply is: 2 The system can not find the file specified

I have even tried writing: copy ls.bmp c:\winnt and it gets the same error messages

The script is ok, it works with me (but I'm a member of the domain admins) and it also works for the users if the script is run AFTER they log on and have Windows up and running.

Top
#29906 - 2002-09-29 03:13 PM Re: Copying files
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
What OS? XP has some issues with %0. When you print the copy command does it look properly formed? The error you specified, "2", would indicate to me a problem with the first paramter of the copy command, not the second.
_________________________
Home page: http://www.kixhelp.com/hb/

Top
#29907 - 2002-09-29 03:22 PM Re: Copying files
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
In your previous example you stated you tried "copy ls.bmp c:\winnt" what is the path for ls.bmp? Use quotes around each parameter.
_________________________
Home page: http://www.kixhelp.com/hb/

Top
#29908 - 2002-09-29 03:26 PM Re: Copying files
Sverre Offline
Getting the hang of it

Registered: 2002-09-29
Posts: 52
The problem seems to be on any machines as long as the user don't have domain admin rights.

Other copy commands with %0/../ works just fine.

The ls.bmp resides in the netlogon directory.

I did not use quotes around the parameters: copy ls.bmp c:\winnt. But since it works when I log on as a domain admin I figure the problem isn't there, but rather something to do with the user rights. The authenticated users has read/write/execute rights to the netlogon directory and I even tried giving everyone full rights, but it didn't help.

Top
#29909 - 2002-09-29 03:32 PM Re: Copying files
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
If the logon script can execute from the netlogon directory, then there should not be a permissions problem there. Error 2 indicates a path issue. Does the file have any specific permission or attributes? If the user lacked permissions, I would have expected an error 5 (Access Denied).

Change your copy command to copy to "%temp%" to avoid permission issues on the destination. Does that work?
_________________________
Home page: http://www.kixhelp.com/hb/

Top
#29910 - 2002-09-29 03:55 PM Re: Copying files
Sverre Offline
Getting the hang of it

Registered: 2002-09-29
Posts: 52
Have tried copying to "c:\temp", nothing there (works for domain admins).

Tried giving everyone full control of the file, still nothing there.

As far as I can understand there has to be something in the way things work when they log on. Obviously the file isn't accessible to the user during the login, it is after the login has been done, but not until the explorer is up. The strange thing is that it's accessible to a domain admin during the login process both on an XP and a W2K machine.

Top
#29911 - 2002-09-29 04:05 PM Re: Copying files
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
the user may not have access to c:\temp. On W2K and XP %temp% is not c:\temp.
_________________________
Home page: http://www.kixhelp.com/hb/

Top
#29912 - 2002-09-29 04:07 PM Re: Copying files
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
Create a new text file and place it in the netlogon directory. Try to copy it to "%temp%" (Use the environment variable). Does that work?
_________________________
Home page: http://www.kixhelp.com/hb/

Top
#29913 - 2002-09-29 04:17 PM Re: Copying files
Fernando Madruga Offline
Starting to like KiXtart

Registered: 2002-08-21
Posts: 149
Loc: Coimbra.Portugal.Europe.Earth....
Maybe this won't help, but who knows... [Smile]

Is the file already there (on the destination)? Is it read-only? Have you tried hard-coding the "C:\WINNT" instead of reading it from the registry just to see if it works? If it does, you'll have to use regedt32 (not regedit) and check that registry key's permissions.

Don't know if any of this will help, because it's weird that the same operation works after the user is logged on!
_________________________
Later,   [b]Mad[/b]ruga

Top
#29914 - 2002-09-29 05:01 PM Re: Copying files
Sverre Offline
Getting the hang of it

Registered: 2002-09-29
Posts: 52
Tried it with c:\winnt and it doesn't help.

Tried it with a text file "test.txt" and it doesn't work.

I copy some files from the same location a couple of rows above where this is and it works (to a different directory).

Tried to put the file in another folder under netlogon and it doesn't work.

I'm completely out of ideas.

Top
#29915 - 2002-09-29 05:11 PM Re: Copying files
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
I can't see %0\.. working from KiX. From a batch file yes...

Try using one of the KiX macros

@ScriptDir
@StartDir
@LServer
@LDrive
@CurDir
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#29916 - 2002-09-29 05:12 PM Re: Copying files
Sverre Offline
Getting the hang of it

Registered: 2002-09-29
Posts: 52
Tried to post the script but it only complains about HTML tags, I REALLY hate that!
Top
#29917 - 2002-09-29 05:14 PM Re: Copying files
Sverre Offline
Getting the hang of it

Registered: 2002-09-29
Posts: 52
It works well other places in the script? And I get the same problem if I don't use %0\.., so I expect it is something else.
Top
#29918 - 2002-09-29 05:16 PM Re: Copying files
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22343
Loc: OK
 
did you try with @scriptdir?
 
_________________________
!

download KiXnet

Top
#29919 - 2002-09-29 05:21 PM Re: Copying files
Fernando Madruga Offline
Starting to like KiXtart

Registered: 2002-08-21
Posts: 149
Loc: Coimbra.Portugal.Europe.Earth....
Print the values you're getting, (don't assume you know them!), then run this:
code:
CACLS folder_or_file_path

on all 3 items: source file, target path, target file. Then post the resulting outputs here...

[ 29. September 2002, 17:23: Message edited by: Fernando Madruga ]
_________________________
Later,   [b]Mad[/b]ruga

Top
#29920 - 2002-09-29 05:24 PM Re: Copying files
Fernando Madruga Offline
Starting to like KiXtart

Registered: 2002-08-21
Posts: 149
Loc: Coimbra.Portugal.Europe.Earth....
BTW: you're probably not using the code tags around your code when posting. Look below the text box and find the "CODE" button and use it to insert the proper tags; then paste your code in between those two tags.
_________________________
Later,   [b]Mad[/b]ruga

Top
#29921 - 2002-09-29 05:25 PM Re: Copying files
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
To post code, insert between code taags. That should solve the complaints about HTML tags.

The %0\.. thing would only work if calling KiX from a batch file and then only if you close it with another % like this.

"%0\..%"
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#29922 - 2002-09-29 05:28 PM Re: Copying files
Sverre Offline
Getting the hang of it

Registered: 2002-09-29
Posts: 52
Source file is

n:\ls.bmp Everyone:F
Everyone:R
NT AUTHORITY\Authenticated Users:R
R
BUILTIN\Administrators:F
NT AUTHORITY\SYSTEM:F

Source path is

n:\ Everyone:(OI)(CI)R
NT AUTHORITY\Authenticated Users:R
NT AUTHORITY\Authenticated Users:(OI)(CI)(IO)(special access:)
GENERIC_READ
GENERIC_EXECUTE

R
(OI)(CI)(IO)(special access:)
GENERIC_READ
GENERIC_EXECUTE

BUILTIN\Administrators:F
BUILTIN\Administrators:(OI)(CI)(IO)F
NT AUTHORITY\SYSTEM:F
NT AUTHORITY\SYSTEM:(OI)(CI)(IO)F
CREATOR OWNER:(OI)(CI)(IO)F

Target path is (they have admin rights on local PC)

c:\WINDOWS BUILTIN\Users:R
BUILTIN\Users:(OI)(CI)(IO)(special access:)
GENERIC_READ
GENERIC_EXECUTE

BUILTIN\Power Users:C
BUILTIN\Power Users:(OI)(CI)(IO)C
BUILTIN\Administrators:F
BUILTIN\Administrators:(OI)(CI)(IO)F
NT AUTHORITY\SYSTEM:F
NT AUTHORITY\SYSTEM:(OI)(CI)(IO)F
BUILTIN\Administrators:F
CREATOR OWNER:(OI)(CI)(IO)F

Target file doesn't exist.

Top
Page 1 of 2 12>


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 186 anonymous users online.
Newest Members
dimi575, Drecksnacken, Nlill, webtools321, multiman
17734 Registered Users

Generated in 0.045 seconds in which 0.012 seconds were spent on a total of 13 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org