Page 1 of 1 1
Topic Options
#175669 - 2007-04-25 04:39 PM Copy/Move Problem
DStelz Offline
Getting the hang of it

Registered: 2007-01-26
Posts: 72
Loc: Green Bay, WI
I am trying to do a simple script for us to use if we need to replace a corrupt XP profile. For some reason the final copy doesn't work and returns an error code 3. I've broken it up and it works in parts, but when the whole thing is together it will not copy the folders to the directory. Here is the code:
 Code:
$SO=SETOPTION("Explicit", "ON")
$SO=SETOPTION("NoMacrosInStrings", "ON")
$SO=SETOPTION("NoVarsInStrings", "ON")
BREAK ON

DIM $userid
DIM $server
DIM $dir

"Enter user id:" Gets $userid
"Enter server name:" Gets $server

$dir = "\\" + $server + "\profiles$\" + $userid + "\"

Copy "\\" + $server + "\profiles$\" + $userid + "\Favorites\" "\\servername\apps$\kixtart\temp\Favorites\" /s
Copy "\\" + $server + "\profiles$\" + $userid + "\Desktop\" "\\servername\apps$\kixtart\temp\Desktop\"
Copy "\\" + $server + "\profiles$\" + $userid + "\application data\microsoft\outlook\*.*nk2" "\\servername\apps$\kixtart\temp\outlook\"
Copy "\\" + $server + "\profiles$\" + $userid + "\Application Data\Microsoft\Internet Explorer\Quick Launch\" "\\servername\apps$\kixtart\temp\quick\"
Move "\\" + $server + "\profiles$\" + $userid "\\" + $server + "\\profiles$\" + $userid + ".old"
Copy "\\servername\apps$\kixtart\temp\" $dir /s

It just copies certain folders to a temp folder, renames the profile and then copies the files from the temp folder to the new profiles directory.

If you have any questions, let me know.

Top
#175672 - 2007-04-25 04:58 PM Re: Copy/Move Problem [Re: DStelz]
Mart Moderator Offline
KiX Supporter
*****

Registered: 2002-03-27
Posts: 4672
Loc: The Netherlands
My guess is it has to do with privileges.

By default nobody but the profile owner has privileges to even access the folder where the profile is stored on the server.

As a side note: roaming profiles s#uck but that’s just my opinion
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.

Top
#175684 - 2007-04-25 08:39 PM Re: Copy/Move Problem [Re: Mart]
DStelz Offline
Getting the hang of it

Registered: 2007-01-26
Posts: 72
Loc: Green Bay, WI
I would think as a Domain Admin I would have rights. If I leave out the 2nd, 3rd, and 4th Copy lines, it works how it's supposed to.
Top
#175685 - 2007-04-25 08:48 PM Re: Copy/Move Problem [Re: DStelz]
Benny69 Offline
Moderator
*****

Registered: 2003-10-29
Posts: 1036
Loc: Lincoln, Ne
in your destination you have 'servername' for the servername is that really the server name?
_________________________
Wait don't order yet,... get KiXforms Designer .NET 2.0 (Beta)
KiXforms Designer .NET 2.0 (Beta)

Top
#175686 - 2007-04-25 08:55 PM Re: Copy/Move Problem [Re: Benny69]
Benny69 Offline
Moderator
*****

Registered: 2003-10-29
Posts: 1036
Loc: Lincoln, Ne
in the move command:
Move "\\" + $server + "\profiles$\" + $userid "\\" + $server + "\\profiles$\" + $userid + ".old"

you have a sorce but the destination needs to be seperated
Move "\\" + $server + "\profiles$\" + $userid + "" "\\" + $server + "\\profiles$\" + $userid + ".old" "DESTINATION"
_________________________
Wait don't order yet,... get KiXforms Designer .NET 2.0 (Beta)
KiXforms Designer .NET 2.0 (Beta)

Top
#175689 - 2007-04-25 10:23 PM Re: Copy/Move Problem [Re: Benny69]
DStelz Offline
Getting the hang of it

Registered: 2007-01-26
Posts: 72
Loc: Green Bay, WI
I'm not really moving it anywhere. I'm just renaming it.

If I do a "\\" + $server + "\profiles$\" + $userid "\\" + $server + "\\profiles$\" + $userid + ".old"

It actually renames dstelz to dstelz.old which is what I want it to do. Then when I want to copy the contents of the temp folder to basically a new folder called dstelz, it creates the folder, but it won't copy the data over.

Top
#175690 - 2007-04-25 10:32 PM Re: Copy/Move Problem [Re: DStelz]
Witto Offline
MM club member
*****

Registered: 2004-09-29
Posts: 1828
Loc: Belgium
I think the coloured hack is redundant:

Move "\\" + $server + "\profiles$\" + $userid "\\" + $server + "\\profiles$\" + $userid + ".old"

Top
#175691 - 2007-04-25 11:00 PM Re: Copy/Move Problem [Re: Witto]
DStelz Offline
Getting the hang of it

Registered: 2007-01-26
Posts: 72
Loc: Green Bay, WI
Wow, I love wasting hours on syntax mistakes. Thanks Witto.
Top
#175697 - 2007-04-26 01:14 AM Re: Copy/Move Problem [Re: DStelz]
Benny69 Offline
Moderator
*****

Registered: 2003-10-29
Posts: 1036
Loc: Lincoln, Ne
good eye Witto, you da man
_________________________
Wait don't order yet,... get KiXforms Designer .NET 2.0 (Beta)
KiXforms Designer .NET 2.0 (Beta)

Top
#175706 - 2007-04-26 10:16 AM Re: Copy/Move Problem [Re: DStelz]
Mart Moderator Offline
KiX Supporter
*****

Registered: 2002-03-27
Posts: 4672
Loc: The Netherlands
 Originally Posted By: DStelz
I would think as a Domain Admin I would have rights. If I leave out the 2nd, 3rd, and 4th Copy lines, it works how it's supposed to.


That was my first thought when I started at my current job. We used roaming profiles then but now we all have local profiles. By default nobody but the profile owner has access to the folder so unless you or someone else changed the permissions even a domain admin cannot access the folder.
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.

Top
Page 1 of 1 1


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

Who's Online
0 registered and 515 anonymous users online.
Newest Members
gespanntleuchten, DaveatAdvanced, Paulo_Alves, UsTaaa, xxJJxx
17864 Registered Users

Generated in 0.06 seconds in which 0.024 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