Page 1 of 1 1
Topic Options
#64126 - 2002-03-28 12:01 AM Copying files using Kix 3.63
Mart Moderator Offline
KiX Supporter
*****

Registered: 2002-03-27
Posts: 4673
Loc: The Netherlands
Hi,

I use this command the copy files using kix 3.63.

Shell "%COMSPEC% /E:1024 /C COPY " + "%windir%\outlook.prf" "%userprofile%\outlook.prf"

The copy goes well but it copies the files to c:\ in stead of the userprofiles directory [Confused]
Changing users (user to admin) make no difference.

Anyone??

[ 27 March 2002, 12:02: Message edited by: R2D2 ]
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.

Top
#64127 - 2002-03-28 12:17 AM Re: Copying files using Kix 3.63
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
on what system is that?
all windows do not support %userprofile%.
_________________________
!

download KiXnet

Top
#64128 - 2002-03-27 01:50 PM Re: Copying files using Kix 3.63
Mart Moderator Offline
KiX Supporter
*****

Registered: 2002-03-27
Posts: 4673
Loc: The Netherlands
Sorry.

Running Win2K pro SP2 + post SP2 security pack. All UK language.
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.

Top
#64129 - 2002-03-27 02:25 PM Re: Copying files using Kix 3.63
DrillSergeant Offline
MM club member
*****

Registered: 2004-07-09
Posts: 1164
Loc: Eijsden, the Netherlands
What does this do for you?:

;--- start of script ---
$windir=ExpandEvironmentVars('%windir%')
$profile=ExpandEnvironmentVars('%userprofile%')

copy '$windir\outlook.prf' '$profile'
;--- end of script ---

If that doesn't work either try to see if the variables are resolved correctly, by doing something like this:

;--- start of script ---
$windir=ExpandEvironmentVars('%windir%')
$profile=ExpandEnvironmentVars('%userprofile%')

CLS
? 'windir = >'+$windir+'<'
? 'profile = >'+$profile+'<'
get $dummy
;--- end of script ---

good luck!
_________________________
The Code is out there

Top
#64130 - 2002-03-27 03:09 PM Re: Copying files using Kix 3.63
Mart Moderator Offline
KiX Supporter
*****

Registered: 2002-03-27
Posts: 4673
Loc: The Netherlands
I made some schanges to my original script for better and easyer functionality.

quote:
;--- start of script ---
$windir=ExpandEvironmentVars('%windir%')
$profile=ExpandEnvironmentVars('%userprofile%')

copy '$windir\outlook.prf' '$profile'
;--- end of script ---

Outlook.prf is still copied to c:

All variables are resolved correctly. I tested this using by letting kix print the variables on
screen.

This is my script:
;**** Created with KiXscripts Editor | http://KiXscripts.com ****
;**** Last Modified on 27-03-2002 at 10:58:41 by ****

; ? "** Starting Automatic MS Outlook Profile Generation..."
? "** Checking if Outlook is installed..."
$i1 = Exist ("c:\program files\microsoft office\office10\outlook.exe")
If ($i1 = 1) Goto Check_Profile
? "** Outlook is NOT installed, skipping to end of script..."
Goto End

:Check_Profile
? "** Checking if outlook userprofile exists..."
$i2 = Exist ("%userprofile%\application data\microsoft\outlook\%username%.fav")

; Setting outlook profile import registry setting

;$rc = WriteValue("HKEY_CURRENT_USER\Software\Microsoft\Office\10.0\Outlook\setup", "ImportPRF", "%userprofile%\outlook.prf", "REG_SZ")
If ($i2 = 0) Goto Copy_Profile
? "** Outlook profile found... skipping to end of script..."
Goto End

:Copy_Profile
? "** Copying Default Outlook Profile..."
Select
Case Ucase(@HOMESHR) = "\\NT1\USERS\%username%"
Shell "%COMSPEC% /E:1024 /C COPY " + @LDRIVE + "olp_rot.prf " + "%windir%\outlook.prf > NUL"
Case Ucase(@HOMESHR) = "\\AMSSVR01\USERS\%username%"
Shell "%COMSPEC% /E:1024 /C COPY " + @LDRIVE + "olp_ams.prf " + "%windir%\outlook.prf > NUL"
EndSelect
? "** Creating new Outlook profile based on current user..."
Shell "%COMSPEC% /E:1024 /C " + @LDRIVE + "prfpatch.exe"
IF @HOMESHR = \\NT1\USERS
Shell "%COMSPEC% /E:1024 /C COPY " + "%windir%\outlook.prf" "\\nt1\users\%username%\outlook.prf"
ENDIF
IF @HOMESHR = \\AMSSVR01\USERS
Shell "%COMSPEC% /E:1024 /C COPY " + "%windir%\outlook.prf" "\\AMSSVR01\users\%username%\outlook.prf"
ENDIF
$rc = WriteValue("HKEY_CURRENT_USER\Software\Microsoft\Office\10.0\Outlook\setup", "ImportPRF", "%HOMESHARE%\outlook.prf", "REG_SZ")
:End

This is what i see when i run it:

** Checking if Outlook is installed...
** Checking if outlook userprofile exists...
** Copying Default Outlook Profile...
** Creating new Outlook profile based on current user... 1 file(s) copied.
\\nt1\users\Administrator\outlook.prf

When i add a line to copy c:\outlook.prf to the userdir it says that kix can't copy a file to itself. [Confused] [Mad]
All script seems to bee ok but the users userdir i resolved as c: by kix. When i let kix display the @HOMESHR variabel it shows \\server\users adding the suername shows \\server\users\username.
Copying a file to this location will result in the file beeing copied to c: [Confused] [Mad]

[ 27 March 2002, 18:49: Message edited by: R2D2 ]
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.

Top
#64131 - 2002-03-27 04:08 PM Re: Copying files using Kix 3.63
DrillSergeant Offline
MM club member
*****

Registered: 2004-07-09
Posts: 1164
Loc: Eijsden, the Netherlands
[wild guess]
are you sure about the profilepath in the user manager?

maybe the users profile path is set to 'C:\' ???
[/wild guess]

[edit]
naah, after thinking about that, it can't be it...
[/edit]

[edit2]
what's in the value in this key?:

KEY: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList

VALUE: ProfilesDirectory
[/edit2]

[ 27 March 2002, 16:17: Message edited by: DrillSergeant ]
_________________________
The Code is out there

Top
#64132 - 2002-03-27 06:47 PM Re: Copying files using Kix 3.63
Mart Moderator Offline
KiX Supporter
*****

Registered: 2002-03-27
Posts: 4673
Loc: The Netherlands
Ok looking at some kix code for 3 1/2 days will make you kind of blind for your own mistakes (not to forget a little bit grazie [Razz] ).
An ex-coworker of me looked at the script this afternoon and solved my problem in about 10 minutes, of course he's [Big Grin] now, I felt pretty dumb.

Just removing the target filename solved everything.

Thanx for the help you supplied, it did not solve the problem but thanx anyway.

And now?? First I need a Beer!

[Edit]
In case anybody wants to know, this the working code.

; ? "** Starting Automatic MS Outlook Profile Generation..."
? "** Checking if Outlook is installed..."
$i1 = Exist ("c:\program files\microsoft office\office10\outlook.exe")
If ($i1 = 1) Goto Check_Profile
? "** Outlook is NOT installed, skipping to end of script..."
Goto End

:Check_Profile
? "** Checking if outlook userprofile exists..."
$i2 = Exist ("%userprofile%\application data\microsoft\outlook\%username%.fav")
$rc = WriteValue("HKEY_CURRENT_USER\Software\Microsoft\Office\10.0\Outlook\setup", "ImportPRF", "%HOMESHARE%\outlook.prf", "REG_SZ")

If ($i2 = 0) Goto Copy_Profile
? "** Outlook profile found... skipping to end of script..."
Goto End

:Copy_Profile
? "** Copying Default Outlook Profile..."
Select
Case Ucase(@HOMESHR) = "\\NT1\USERS"
Shell "%COMSPEC% /E:1024 /C COPY " + @LDRIVE + "olp_rot.prf " + "%windir%\outlook.prf > NUL"
Case Ucase(@HOMESHR) = "\\AMSSVR01\USERS"
Shell "%COMSPEC% /E:1024 /C COPY " + @LDRIVE + "olp_ams.prf " + "%windir%\outlook.prf > NUL"
EndSelect
? "** Creating new Outlook profile based on current user..."
Shell "%COMSPEC% /E:1024 /C " + @LDRIVE + "prfpatch.exe"

$source = %WINDIR%
$dest = @HOMESHR

Select
Case Ucase(@HOMESHR) = "\\NT1\USERS"
Shell "%COMSPEC% /E:1024 /C COPY " + $source + "\outlook.prf " + "\\NT1\users\"+ @USERID
Case Ucase(@HOMESHR) = "\\AMSSVR01\USERS"
Shell "%COMSPEC% /E:1024 /C COPY " + $source + "\outlook.prf " + "\\AMSSVR01\users\"+ @USERID
EndSelect

$rc = WriteValue("HKEY_CURRENT_USER\Software\Microsoft\Office\10.0\Outlook\setup", "ImportPRF", "%HOMESHARE%\outlook.prf", "REG_SZ")

:End

[ 27 March 2002, 19:01: Message edited by: R2D2 ]
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.

Top
Page 1 of 1 1


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

Who's Online
0 registered and 2419 anonymous users online.
Newest Members
batdk82, StuTheCoder, M_Moore, BeeEm, min_seow
17885 Registered Users

Generated in 0.061 seconds in which 0.03 seconds were spent on a total of 12 queries. Zlib compression enabled.

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