Advertisement
Guest User

Untitled

a guest
Jun 17th, 2019
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.90 KB | None | 0 0
  1. $computer_info = systeminfo
  2. $network_info = ipconfig /all
  3. $netstat_info = netstat -ano
  4. $firewall_rules_all_profiles_info = netsh advfirewall firewall show allprofiles
  5. $firewall_rules_info = netsh advfirewall firewall show rule name=all
  6. $routing_table_info = Get-WmiObject -class "Win32_IP4RouteTable"
  7. $os_system_logs_info = Get-EventLog -LogName System -Newest 1000
  8. $os_application_logs_info = Get-EventLog -LogName Application -Newest 1000
  9. $os_services_info = Get-WmiObject Win32_Service
  10. $os_processes_info = Get-Process | Select *
  11. $logpath = "%TEMP%\MigrationLogs\$env:computername"
  12. $timestamp = get-date -Format yyyyMMdd-hhmm
  13. New-Item -ItemType directory -Path "%TEMP%\MigrationLogs\$env:computername"
  14.  
  15. $computer_info | Out-File -FilePath "$logpath\computer-info-$timestamp.txt"
  16. $network_info | Out-File -FilePath "$logpath\network-info-$timestamp.txt"
  17. $netstat_info | Out-File -FilePath "$logpath\netstat-info-$timestamp.txt"
  18. $firewall_rules_all_profiles_info | Out-File -FilePath "$logpath\firewall-rules-all-profiles-info-$timestamp.txt"
  19. $firewall_rules_info | Out-File -FilePath "$logpath\firewall-rules-info-$timestamp.txt"
  20. $routing_table_info | Export-Csv -NoTypeInformation -UseCulture "$logpath\routing-table-info-$timestamp.csv"
  21. $os_system_logs_info | Export-Csv -NoTypeInformation -UseCulture "$logpath\os-system-logs-info-$timestamp.csv"
  22. $os_application_logs_info | Export-Csv -NoTypeInformation -UseCulture "$logpath\os-application-logs-info-$timestamp.csv"
  23. $os_services_info | Export-Csv -NoTypeInformation -UseCulture "$logpath\os-services-info-$timestamp.csv"
  24. $os_processes_info | Export-Csv -NoTypeInformation -UseCulture "$logpath\os-processes-info-$timestamp.csv"
  25. logman start "system\system diagnostics"
  26. Start-Sleep -s 90
  27. Copy-Item "C:\PerfLogs\System\Diagnostics\" -Destination "$logpath\Perfmon\" -Recurse
  28. Copy-Item "C:\Windows\System32\Drivers\etc\hosts" -Destination "$logpath\hostfile.txt"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement