- Thread Author
- #1
I've writen some scripts to change the C:\user to an other partition.
all seems to work but I can not change the security on the SYMBLINK and Junctions (not the directories)
assuming all in c:\users\%USERNAME% is machine independent ...
All data will be recreated at first login anyhow
 
x:\users\%username% can be used from a remote machine (workgroup roaming)
it can be placed on any other partition
 
C:\Users\All Users
C:\Users\Default
C:\Users \Default User
 
are simply redirected to thier original position using MKLINK
 
 
Procedure execute after Win7 install ( only one user defined)
 
 
	
	
	
		
 
I want to set the same security on the new partition /Users/All Users, Default User \ Default
 
 
but I'm only acting on the real directory ..... I need suggestions(not an experienced Xcacls user)
 
 
 
HOME_HOME environment variable is used to pass the partition location
	
	
	
		
 
 
 
 
All comments welcome.
Did I forget some thing ???? please comment
				
			all seems to work but I can not change the security on the SYMBLINK and Junctions (not the directories)
assuming all in c:\users\%USERNAME% is machine independent ...
All data will be recreated at first login anyhow
x:\users\%username% can be used from a remote machine (workgroup roaming)
it can be placed on any other partition
C:\Users\All Users
C:\Users\Default
C:\Users \Default User
are simply redirected to thier original position using MKLINK
Procedure execute after Win7 install ( only one user defined)
		Code:
	
	     > UserEnv   H:
rem 
rem   create  user  environment in Windows /Vista 
REM   change  registry  settings 
rem   destination  %1%
rem 
set  home_home=%1
set protect=cscript H:\install\Path\xcacls.vbs
pushd %cd%
md %home_home%\Users
cd/D %home_home%\Users
rem    MKLINK /D   xxx    c:\aa\bbb
rem    delete  using  explorer 
   MKLink /D  "All Users"  %ALLUSERSPROFILE%
   MKLink /J "default"    C:\Users\Default
   MKLINK /J "default User" C:\USERS\Default
   ROBOCOPY c:\Users\Public  %home_home%\Users\Public /Z /R:1 /W:1 /MIR /COPYALL
REM Security  Hidden ...
rem    I no indexed 
rem /L   work on the  link instead  of  on the directory 
   Attrib/L  +R +I +H "All Users"  
   Attrib/L  +r +h "default"   
   Attrib/L  +R +I +S +H "Default User" 
rem    %protect%  "ALL USERS"   /G Everyone:S ,SYSTEM:, Administrators:S /D Everyone:S
rem    %protect%  "Default"     /G Everyone:rlx ,SYSTEM:f, Administrators:F ,users:rlx /D Everyone:S
rem    %protect%  "Default User"     /G Everyone:,SYSTEM:, Administrators:  /D Everyone:S
popD
rem  HKLM\Software\Microsoft\Windows NT\CurrentVersion\ProfileList  
userEnv.Vbs              rem  cange  the  registry  key's    Runned separately  for  nowI want to set the same security on the new partition /Users/All Users, Default User \ Default
but I'm only acting on the real directory ..... I need suggestions(not an experienced Xcacls user)
HOME_HOME environment variable is used to pass the partition location
		Code:
	
	Dim WSHShell,cmdComputer
cmdComputer="."
Set WSHShell = WScript.CreateObject("WScript.Shell")
Call SetEnv("$Home_Home",           "H:")    ' temp fixed
NSTALL_HOME",        "%Home_Home%\Install")
call SetReg("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList\ProfilesDirectory", "%HOME_HOME%\Users")
call SetReg("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList\Public", "%HOME_HOME%\Users\Public")
 
Set WSHShell = Nothing    
 WScript.Quit(0)
Function addPath(Value)
 dim path
  Dim schellObj,envobj
   Value=trim(Value)
    set shellObj = WScript.CreateObject("WScript.Shell") 
    set envObj = shellObj.Environment("System")   
    path=envObj("PATH")
    path=trim(path)
    if (right(path,1) <> ";") then
         path=path&";"
    end if 
    if ( instr(1,path,Value,1) =0 ) then 
       path=path & value  & ";"   'add  to the  path 
       envObj("PATH")=path
    End If 
End  Function
Function SetReg(Path,Valu)
DIM schellOBJ,Key
    Path=trim(Path)
    Valu=Trim(Valu) 
    set shellObj = WScript.CreateObject("WScript.Shell") 
    Key="REG_EXPAND_SZ"
    ShellObj.RegWrite Path,Valu,key
End Function
Function SetEnv(Vari,Value)
  Dim schellObj,envobj,key,key2,intrc 
 '
 ' Environment   user and .default  user       and   system($)  
 '
  key=""
  key2=""
  Vari=trim(Vari)
  Value=trim(Value)
  set shellObj = WScript.CreateObject("WScript.Shell")   
  if (left(Vari,1)="$") then    'system  variables 
           Vari= right(Vari,len(Vari)-1)
           key="System"  'key="HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment\"   
  else 
      key ="User"    'HKEY_CURRENT_USER\Environment\"       'HKEY_CURRENT_USER\Environment
  end if  
  set envObj = shellObj.Environment(key)   
  envObj(Vari)=Value     'system and  User  handled  Process  Volatile   not supported yet   
  set shellObj=Nothing
  set envObj=Nothing
End FunctionAll comments welcome.
Did I forget some thing ???? please comment
			
				Last edited: 
			
		
	
								
								
									
    
								
							
							 
 
		 
 
		