r/scripting • u/KernelMayhem • May 03 '22
Robocopy to copy the current login user's profile data excluding the AppData folder and upload to a network destination
Is this possible with Robocopy and/or can be completed using Powershell
4
Upvotes
3
u/rdinsb May 03 '22
https://www.reddit.com/r/PowerShell/comments/3cbipl/copy_user_filesfolders_from_user_machines_to_a/?utm_source=share&utm_medium=ios_app&utm_name=iossmf
1
u/AcceptablePlay May 05 '22
You Could always use Powershell to get the correct Path for the currently logged on user:
$User = New-Object System.Security.Principal.NTAccount((Get-CimInstance -ClassName Win32_ComputerSystem).UserName)$UserSID = ($User.Translate([System.Security.Principal.SecurityIdentifier])).Value$LoggedOnUserProfilePath = Get-ItemPropertyValue -Path (Join-Path -Path 'Registry::HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList' -ChildPath $UserSid) -Name ProfileImagePathThe $LoggedOnUserProfilePath variable will always contain the correct path
And continue on from there