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.