Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $ComputerName = $env:COMPUTERNAME
- $LoggedOnUser = (qwinsta /SERVER:$ComputerName) -replace '\s{2,22}', ',' | ConvertFrom-Csv | Where-Object {$_ -like "*Acti*"} | Select-Object -ExpandProperty USERNAME
- if (!($LoggedOnUser) ) { Write-Host "No user is logged on to $ComputerName" -ForegroundColor Red ; break }
- $LoggedPath = "C:\Users\$LoggedOnUser\Documents"
- $OnePath = (Get-ChildItem $LoggedPath -recurse | Where-Object {$_.PSIsContainer -eq $true -and $_.Name -match "OneDrive"}).Name
- $1DPath = $LoggedPath + "\" + $OnePath
- get-childitem "$1DPath" -Force -File -Recurse #| where Attributes -eq 'Hidden, Archive'
Add Comment
Please, Sign In to add comment