DarkCoat.psm1
function Get-ShellFolders { New-PSDrive -PSProvider Registry -Name HKU -Root HKEY_USERS if(Test-Path C:\TempPath){ Write-Host "Temp Path OK" }else{ mkdir C:\TempPath } $sids= Get-ChildItem -Path "HKU:\*" | Where-Object {$_.Name -match '-.*-.*-.*-.*-' -and $_.Name -notLike '*_Classes' } | Select-Object -expandproperty Name $sidsTrimed = $sids.Substring(11) foreach ($i in $sidsTrimed){ #$computerName = Get-ComputerInfo | Select-Object -expandproperty CsDNSHostName $desktopFolder =Get-ItemPropertyValue -Path "HKU:\$i\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "Desktop" $documentsFolder = Get-ItemPropertyValue -Path "HKU:\$i\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" -Name "Personal" $desktopFolder $documentsFolder # [PSCustomObject]@{ # ComputerName = $computerName # Desktop = $desktopFolder # Documents = $documentsFolder #} | Export-Csv -Append -NoTypeInformation -Encoding Utf8 -path "asdf.csv" } Remove-PSDrive -Name HKU } function Test{ Add-Type -AssemblyName System.Windows.Forms do { [System.Windows.Forms.SendKeys]::SendWait("{TAB}") Start-Sleep -Seconds 60 } while ($true)s } |