Advertisement
wicus3x

Skrypt1

Jul 4th, 2020
1,757
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. $i=1
  2. $raportuj='t'
  3. $br = "<br><br>"
  4. $command = 'cat /proc/meminfo | grep Available'
  5.  
  6. while($i -lt 11)
  7. {
  8. $compid = "<h2>Raport dotyczący systemów nr " + $i + "</h2><br><br>"
  9.  
  10. $cpuid = "AD CPU"
  11. $cpuinfo = Get-CimInstance -Computername kontroler -Class CIM_Processor -ErrorAction Stop | Select-Object LoadPercentage
  12. $cpu = $cpuid + " " + $cpuinfo
  13.  
  14. $services = Get-Service -Computername kontroler | Select ServiceName, Status | ConvertTo-HTML
  15.  
  16. $userid = "User wykonywujący skrypt: "
  17. $userinfo = $env:UserName
  18. $user = $userid + $userinfo
  19.  
  20. $ramid = "Windows RAM: "
  21. $raminfo = Get-CimInstance -Computername kontroler -Class Win32_OperatingSystem | Select FreePhysicalMemory
  22. $ram = $ramid + " " + $raminfo
  23.  
  24. $compid,$cpu,$br,$ktoWykonuje, $user,$br,$ram,$br,$ramLinux,$br,$services | Out-File -FilePath C:\inetpub\wwwroot\Raport$i.html
  25. Copy-Item -Path C:\inetpub\wwwroot\Raport$i.html -Destination 'C:\inetpub\wwwroot\' -ToSession (New-PSSession -ComputerName wscore)
  26. $i++
  27. if($i -eq 11)
  28. {
  29.    Write-Host 'Powtorzyc? (t/n)'
  30.    $raportuj = Read-Host
  31.    if($raportuj -eq 't')
  32.    {
  33.      $i=1;
  34.    }
  35. }
  36. sleep 10
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement