Advertisement
Guest User

Untitled

a guest
Apr 22nd, 2019
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.28 KB | None | 0 0
  1. <#
  2. (get-childitem -recurse C:\users\*\favorites) |
  3. select-object @{N='PC';E={$env:computername}}, @{N='User';E={[regex]::match($_.fullname, "users(.*)Favorites").Groups[1].Value}}, name |
  4. Where-Object -FilterScript {$_.Name -ne "Links" -And $_.Name -ne "Bing.url"}
  5. #>
  6. $ping_response = 0
  7. while ($ping_response -eq 0) {
  8. if ((Test-NetConnection tlncm01.energia.sise).pingsucceeded -ne $True) {
  9. Write-Output "TLNCM01 ei ole hetkel k2ttesaadav"
  10. Start-Sleep -Seconds 5
  11. } else {
  12. $users = Get-ChildItem c:\users | Select-Object Name -ExpandProperty Name | Where-Object -FilterScript {$_.Name -ne "defaultuser0" -And $_.Name -ne "Public"}
  13. $csv = foreach ($user in $users) {
  14. $favs = Get-ChildItem c:\users\$user\favorites -Recurse | Select-Object Name -ExpandProperty name | Where-Object -FilterScript {$_.Name -ne "Links" -And $_.Name -ne "Bing.url" -And $_.Name -ne "Web Slice Gallery.url" -And $_.Name -ne "Suggested Sites.url"}
  15. "string" | Select-Object @{N='PC';E={$env:computername}}, @{N='User';E={$user}}, @{N='URL count';E={$favs.count}}
  16. }
  17. $csv | export-csv "\\tlncm01\Inventuur$\favorites\$env:computername.csv" -UseCulture -NoTypeInformation
  18. $ping_response = 1
  19. Write-Output "CSV eksporditud"
  20. }
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement