Add files via upload

This commit is contained in:
itlifeskills 2025-01-12 11:55:25 -06:00 committed by GitHub
parent 13e696ef1b
commit c4d521fe36
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 48 additions and 0 deletions

27
CreateDFSFolders.ps1 Normal file
View 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
View 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
}