Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- :Start
- @echo off
- set /p password="Password:"
- :Nextcomp
- set /p computer="Computer name:"
- wmic /user:username /password:%password% /node:"%computer%" memorychip get capacity
- set /P c=Do you want to get info about another computer (y/n)?
- if /I "%c%" EQU "y" goto :Nextcomp
- if /I "%c%" EQU "n" goto :End goto :choice
- pause
- :End
- $resultstxt = "C:UsersuserDocumentsresults.csv"
- Param(
- [Parameter(Mandatory=$true, Position=0, HelpMessage="Password?")]
- [SecureString]$password
- )
- $pw = [Runtime.InteropServices.Marshal]::PtrToStringAuto([Runtime.InteropServices.Marshal]::SecureStringToBSTR($password))
- $Computer = Read-Host -Prompt 'Computer name'
- $out = @()
- If (!(Test-Connection -ComputerName $Computer -Count 1 -Quiet)) {
- Write-Host "$Computer not on network."
- Continue
- }
- foreach($object in $HostList) {
- $RAM = get-wmiobject -user user -password $pw -computername $object.("Computer")-class win32_physicalmemory
- $DeviceInfo= @{}
- $DeviceInfo.add("RAM", "$([math]::floor($RAM.Capacity/ (1024 * 1024 * 1024 )) )" + " GB" )
- $DeviceInfo.add("Computer Name", $vol.SystemName)
- $out += New-Object PSObject -Property $DeviceInfo | Select-Object "RAM"
- Write-Verbose ($out | Out-String) -Verbose
- $out | Export-CSV -FilePath $resultstxt -NoTypeInformation
Add Comment
Please, Sign In to add comment