Guest User

Untitled

a guest
Jan 31st, 2019
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.26 KB | None | 0 0
  1. :Start
  2. @echo off
  3. set /p password="Password:"
  4. :Nextcomp
  5. set /p computer="Computer name:"
  6. wmic /user:username /password:%password% /node:"%computer%" memorychip get capacity
  7. set /P c=Do you want to get info about another computer (y/n)?
  8. if /I "%c%" EQU "y" goto :Nextcomp
  9. if /I "%c%" EQU "n" goto :End goto :choice
  10. pause
  11. :End
  12.  
  13. $resultstxt = "C:UsersuserDocumentsresults.csv"
  14. Param(
  15. [Parameter(Mandatory=$true, Position=0, HelpMessage="Password?")]
  16. [SecureString]$password
  17. )
  18. $pw = [Runtime.InteropServices.Marshal]::PtrToStringAuto([Runtime.InteropServices.Marshal]::SecureStringToBSTR($password))
  19. $Computer = Read-Host -Prompt 'Computer name'
  20. $out = @()
  21. If (!(Test-Connection -ComputerName $Computer -Count 1 -Quiet)) {
  22. Write-Host "$Computer not on network."
  23. Continue
  24. }
  25. foreach($object in $HostList) {
  26. $RAM = get-wmiobject -user user -password $pw -computername $object.("Computer")-class win32_physicalmemory
  27. $DeviceInfo= @{}
  28. $DeviceInfo.add("RAM", "$([math]::floor($RAM.Capacity/ (1024 * 1024 * 1024 )) )" + " GB" )
  29. $DeviceInfo.add("Computer Name", $vol.SystemName)
  30. $out += New-Object PSObject -Property $DeviceInfo | Select-Object "RAM"
  31. Write-Verbose ($out | Out-String) -Verbose
  32. $out | Export-CSV -FilePath $resultstxt -NoTypeInformation
Add Comment
Please, Sign In to add comment