Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <#
- (get-childitem -recurse C:\users\*\favorites) |
- select-object @{N='PC';E={$env:computername}}, @{N='User';E={[regex]::match($_.fullname, "users(.*)Favorites").Groups[1].Value}}, name |
- Where-Object -FilterScript {$_.Name -ne "Links" -And $_.Name -ne "Bing.url"}
- #>
- $ping_response = 0
- while ($ping_response -eq 0) {
- if ((Test-NetConnection tlncm01.energia.sise).pingsucceeded -ne $True) {
- Write-Output "TLNCM01 ei ole hetkel k2ttesaadav"
- Start-Sleep -Seconds 5
- } else {
- $users = Get-ChildItem c:\users | Select-Object Name -ExpandProperty Name | Where-Object -FilterScript {$_.Name -ne "defaultuser0" -And $_.Name -ne "Public"}
- $csv = foreach ($user in $users) {
- $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"}
- "string" | Select-Object @{N='PC';E={$env:computername}}, @{N='User';E={$user}}, @{N='URL count';E={$favs.count}}
- }
- $csv | export-csv "\\tlncm01\Inventuur$\favorites\$env:computername.csv" -UseCulture -NoTypeInformation
- $ping_response = 1
- Write-Output "CSV eksporditud"
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement