Friday, October 1, 2021

PowerShell Script to copy All Users Profile data in C:\Users\USERID

Here is the PowerShell script:

$sSystemDrive = "$Env:SystemDrive"
$sSiteList = @()
$sSiteList = (
"http://Site01:8080",
"http://Site01:8080"

)

$sUserFolders = Get-ChildItem -Path "$sSystemDrive\Users" -Directory -Exclude "Public","Default","default*"
Write-Host "$sUserFolders"

foreach ($sUser in $sUserFolders) {
    foreach ($sSite in $sSiteList) {

        New-Item -type directory -path "$sUser\AppData\LocalLow\Sun\Java\Deployment\security" -Force -ErrorAction SilentlyContinue
        Add-Content -Path "$sUser\AppData\LocalLow\Sun\Java\Deployment\security\exception.sites" -Value "$sSite"
    }    
}