Add files via upload
This commit is contained in:
parent
13e696ef1b
commit
c4d521fe36
27
CreateDFSFolders.ps1
Normal file
27
CreateDFSFolders.ps1
Normal file
@ -0,0 +1,27 @@
|
||||
#Path to the Projects folder in namespace root.
|
||||
$path = "\\hq\CorporateData\Projects\"
|
||||
|
||||
#Path to the targets where actual data is stored
|
||||
$targetpaths = "\\CHIPVFS01\Projects\", "\\CHIPVFS02\Projects\"
|
||||
|
||||
#Loop through each target path
|
||||
foreach($targetpath in $targetpaths){
|
||||
|
||||
#Get all the subfolders in the target path
|
||||
$folders= Get-ChildItem -Path $targetpath
|
||||
|
||||
#Loop through each subfolder
|
||||
foreach($folder in $folders){
|
||||
|
||||
#Construct the full path for the folder target
|
||||
$folderpath = $path + $folder
|
||||
|
||||
#Construct the full path for the target
|
||||
$foldertargetpath = $targetpath + $folder
|
||||
|
||||
#Create the folder with target
|
||||
New-DfsnFolder -Path $folderpath -TargetPath $foldertargetpath
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
21
SetHomeDirectory.ps1
Normal file
21
SetHomeDirectory.ps1
Normal file
@ -0,0 +1,21 @@
|
||||
#path to the Users shared folder
|
||||
$homepath = "\\hq\CorporateData\Users\"
|
||||
|
||||
#initial OU where the script starts searching for the users
|
||||
$basepath = "OU=Users,OU=ITLifeSkills,DC=hq,DC=itlifeskills,DC=local"
|
||||
$users = Get-ADUser -SearchBase $basepath -Filter *
|
||||
|
||||
|
||||
foreach($user in $users){
|
||||
#Get the current user identity
|
||||
$identity = $user.SamAccountName
|
||||
#Get the current user name
|
||||
$name = $user.Name
|
||||
|
||||
#construct the homedirectory path
|
||||
$homedirectory = $homepath + $name
|
||||
|
||||
#Update the current user with the new path to the Home directory.
|
||||
Set-ADUser -Identity $identity -HomeDirectory $homedirectory
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user