0 0

Fix roaming profile sync errors

Check Application Eventlog for ID 1509 warnings

Het bestand \\?\UNC\SERVER\UserProfiles$\Username.V6\AppData\Roaming\Microsoft\Installer kan niet naar locatie \\?\C:\Users\Username\AppData\Roaming\Microsoft\Installer worden gekopieerd. Deze fout wordt mogelijk veroorzaakt door netwerkproblemen of onvoldoende beveiligingsrechten. DETAIL - Toegang geweigerd.

 
Make sure rmdir path is correct.

Server:

for /f "delims=|" %f in ('dir /B /A:D-H-R D:\Users\Profiles') do rmdir "D:\Users\Profiles\%f\AppData\Roaming\Microsoft\Installer" /s/q

Workstation:
for /f "delims=|" %f in ('dir /B /A:D-H-R C:\Users') do rmdir "C:\Users\%f\AppData\Roaming\Microsoft\Installer" /s/q

PowerShell:
# Get the current username dynamically
$currentUser = [System.Security.Principal.WindowsIdentity]::GetCurrent().Name.Split("\")[1]
# Define the paths (network and local)
$networkPath = "\\MAE-SVR001\UserProfiles$\$currentUser.V6\AppData\Roaming\Microsoft\Installer"
$localPath = "C:\Users\$currentUser\AppData\Roaming\Microsoft\Installer"
# Check if the network path exists and remove it
if (Test-Path -Path $networkPath) {
    Write-Host "Removing network path: $networkPath"
    Remove-Item -Path $networkPath -Recurse -Force -ErrorAction SilentlyContinue
} else {
    Write-Host "Network path does not exist: $networkPath"
}
# Check if the local path exists and remove it
if (Test-Path -Path $localPath) {
    Write-Host "Removing local path: $localPath"
    Remove-Item -Path $localPath -Recurse -Force -ErrorAction SilentlyContinue
} else {
    Write-Host "Local path does not exist: $localPath"
}

shutdown -r -t 0