Kdyer
KiX Supporter
   
Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
|
Robert,
Two comments:
(1) What are you merging with regedit /s ? You can do these changes all with KiXtart. (2) The use of Z: Drive will give you trouble with Windows 9x clients as they tend to use that drive for logging in.
If you are merging this.. It is setup based on profile anyway and it should not matter..
"HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders"
However, you can use the Shell Folders for your script..
For this, you should be able to change to KiXtart -
$reg='HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer' IF READVALUE($REG,'NoDriveTypeAutoRun')<>'00000095' $RC=WRITEVALUE($REG,'NoDriveTypeAutoRun','00000095','REG_BINARY') ENDIF IF READVALUE($REG,'NoDrives')<>'0000001f' $RC=WRITEVALUE($REG,'NoDrives','0000001f','REG_BINARY') ENDIF
And also with -
$REG='HKCU\Software\Microsoft\Office\10.0\Outlook\Security' IF READVALUE($REG,'Level')<>'3' $RC=WRITEVALUE($REG,'Level','','REG_DWORD') ENDIF IF READVALUE($REG,'UseCRLChasing')<>'1' $RC=WRITEVALUE($REG,'UseCRLChasing','1','REG_DWORD') ENDIF IF READVALUE($REG,'Level1Remove')<>'txt;gif;html;htm' $RC=WRITEVALUE($REG,'Level1Remove','txt;gif;html;htm','REG_SZ') ENDIF
I am still wrestling around with the "adam" thing. You should just simply use the folders that are generated with the user's profile. 'Nuff said.
I took your code and made some simple modifications to it. I also added comments for you to look at as well.
;=============================================================================================== ;**** Created with KiXscripts Editor | http://KiXscripts.com **** ;**** Last Modified on 7/26/2003 at 5:00:40 PM by rbardo **** ;=============================================================================================== $usershel='HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders'
;If @INWIN=1 ; Excludes all Windows 9x systems ;If LocalAdmin ; Only runs if the user has Local workstation admin rights ; Most installers and uninstallers will not run if the user ; does not have Admin rights IF ReadValue('HKLM\Software\VendingData Corporation\WS','RANUNINSTALLER')<>1 ;%ProgramFiles% may not exist under 9x IF Exist('%ProgramFiles%\OfficeView Pro\uninstWS.exe') ;IF You need a specific version, use GETFILEVERSION SHELL '%COMSPEC% /C %ProgramFiles%\OfficeView Pro\uninstWS.exe /S /y' $markws=WriteValue('HKLM\Software\VendingData Corporation\WS','RANUNINSTALLER','1','REG_SZ') ; Mark the registry so that this program does not run every time the user logs in ENDIF ENDIF ;EndIf ;EndIf ; http://www.a-navigator.com/an/index.html USE W: /delete /persistent USE W: '\\holdem\asset_db'+'$$' ;Can't the next line be done with a RUN instead of a shell? SHELL '%COMSPEC% /C W:\ina32.exe' USE W: /delete /persistent
; The rest of the script will run for all systems including Windows 9x USE g: '\\ntbaksrv\common' USE i: '\\ntbaksrv\prod' USE k: '\\ntbaksrv\service' USE m: '\\ntserver\sdpcmrpw' USE o: '\\royal\mis' USE y: '\\terminal\share_point'
IF @INWIN=1 $desktop=readvalue($usershel,'desktop') ELSE $desktop='%WINDIR%\DESKTOP' ENDIF COPY '\\terminal\desktop\*.*' $desktop /s
; use Z: /home ; Don't use this. Map it via the User Manager or AD tools ; Windows 9x Can Not map the Z: drive as the redirector uses this ; drive during the logon process ;*********************************************************************** ;** ;** InstallRegFiles($Regfiles) ;** FUNCTION InstallRegFiles($regdir) $regfiles=$regdir + "\*.reg" IF Exist($regdir) $regfile=Dir($regfiles) WHILE $regfile<>"" AND @error=0 ;Install RegFile IF $nt_mode="yes" ; If this is NT than don't install regfiles that start with "w9_" IF Left($regfile,3) <> "w9_" stpDbgMessage("Info"," - Installing : " + $regdir + "\" + $regfile) IF RunShell($windir + "/regedit /s " + $regdir + "\" + $regfile)<>0 stpDbgMessage("Error","@ERROR - Regedit : " + $regdir + "\" + $regfile,@serror) ENDIF ENDIF ELSE ; If this is W9x than don't install regfiles that start with "nt_" IF Left($regfile,3) <> "nt_" stpDbgMessage("Info"," - Installing : " + $regdir + "\" + $regfile) IF RunShell($windir + "/regedit /s " + $regdir + "\" + $regfile)<>0 stpDbgMessage("Error","@ERROR - Regedit : " + $regdir + "\" + $regfile,@serror) ENDIF ENDIF ENDIF $regfile=Dir() IF @error<>0 AND @error<>18 stpDbgMessage("Error","@ERROR - Retrieving Files for Dir : " +$regdir ,@serror) ENDIF LOOP ENDIF ENDFUNCTION
IF @inwin=1 ;EXCLUE 9X machines from this ;Windows 9x machines may also have trouble with the Z: drive as it is used for logins< /font> ;Windows 9x cannot use ADDPRINTERCONNECTION,SETDEFAULTPRINTER,etc. ; Default My Documents to Z: drive ;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ;Two comments here - ;(1) doubling the \\ will double the write back to the registry ;(2) if you want to quiet the write, assign a dummy var to it IF READVALUE($usershel,'Personal')<>'Z:\' $rc=WriteValue($usershel,'Personal','Z:\','Reg_SZ') ENDIF IF READVALUD($usershel,'My Pictures')<>'Z:\My Pictures' $rc=WriteValue($usershel,'My Pictures','Z:\My Pictures','Reg_SZ') ENDIF
;printers.kix ;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ DIM $prireg, $x, $i, $rc, $ps $loc='HKEY_CURRENT_USER\Network\LPT1' $reg='HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion' $dev=$reg+'\Devices' $nprt=Split(ReadValue($reg+'\Windows','Device'),',')[0] $sysdrv=SubStr('%WINDIR%',1,2)
IF Exist('Z:') $ps='Z:\Scripts_DO_NOT_DELETE' ELSE $ps=$sysdrv+'\Scripts' ENDIF IF 0=Exist($ps) MD $ps ENDIF $ps=$ps+'\Printsetup.ini'
$i=0 DO IF '\\'=Left($x,2) $prireg=$prireg+$x ENDIF $x=EnumValue($dev,$i) $i=$i+1 UNTIL @error
IF Len($prireg) $rc=WriteProfileString($ps,'Printers','','') $prireg=Split($prireg,'\\') FOR $i=1 TO Ubound($prireg) $rc=WriteProfileString($ps,'Printers',$i,'\\'+$prireg[$i]) NEXT ENDIF
SELECT CASE InStr($nprt,'\\') ;WRITE THE DEFAULT PRINTER TO THE CONFIG $rc=WriteProfileString($ps,'Printers','Default',$nprt) USE LPT1: /delete /persistent USE LPT1: $nprt /persistent CASE $nprt='' AND Exist($ps) ;NO DEFAULT PRINTER, LOAD PRINTERS FROM SAVED INFO FOR EACH $key IN Split(ReadProfileString($ps,'Printers',''),Chr(10)) $nul=AddPrinterConnection(ReadProfileString($ps,'Printers',$key)) NEXT $nprt=ReadProfileString($ps,'Printers','Default') $rc=SetDefaultPrinter($nprt) USE LPT1: $nprt /persistent CASE NOT InStr($nprt,'\\') ;LOCAL PRINTER DEFAULT, SO WE WANT TO REMOVE NETWORK MAPPING USE LPT1: /delete /persistent ENDSELECT ENDIF
FUNCTION LocalAdmin() $localadmin=InGroup('@wksta\'+SIDToName('S-1-5-32-544'))-1+@inwin ENDFUNCTION
FUNCTION IdentifyRemoteUser($strcomputer) BREAK ON DIM $strcomputer $objwmiservice = GetObject("winmgmts:" + "{impersonationLevel=impersonate}!\\" + $strcomputer + "\root\cimv2") $colcomputer = $objwmiservice.execquery ("Select * from Win32_ComputerSystem") FOR EACH $objcomputer IN $colcomputer ? $objcomputer.username NEXT ENDFUNCTION
;WHAT IS THIS NEXT LINE USED FOR? SHELL '%COMSPEC% /C \\Ntbaksrv\NETLOGON\use.exe'
HTH,
Kent
|