-
- Influencer
- Posts: 12
- Liked: 4 times
- Joined: May 29, 2024 2:47 pm
- Full Name: Vitalii Feshchenko
- Contact:
Retrieving the RAM and CPU of proxy servers using PowerShell
Hi, community,
I want to know if there is a method to retrieve RAM, CPU resources of the proxy servers using PS.
I want to know if there is a method to retrieve RAM, CPU resources of the proxy servers using PS.
-
- Veteran
- Posts: 945
- Liked: 53 times
- Joined: Nov 05, 2009 12:24 pm
- Location: Sydney, NSW
- Contact:
Re: Retrieving the RAM and CPU of proxy servers using PowerShell
Hi Vitalii,
Do you mean something like this result?
Do you mean something like this result?
Code: Select all
function Get-RemoteSystemInfo {
param (
[string]$computerName
)
# Get the number of CPU cores
$cpuCores = (Get-WmiObject Win32_Processor -ComputerName $computerName).NumberOfCores
# Get the total physical memory
$totalMemory = (Get-WmiObject Win32_PhysicalMemory -ComputerName $computerName |
Measure-Object -Property capacity -Sum).Sum / 1GB # Convert to GB
$systemInfo = [PSCustomObject]@{
ComputerName = $computerName
CPUCores = $cpuCores
TotalMemoryGB= [math]::Round($totalMemory, 2)
}
return $systemInfo
}
function Get-ProxyNames {
# Get a list of VMware backup proxies
$proxies = Get-VBRViProxy | Select-Object -ExpandProperty Name
$proxyNames = @($proxies.Name)
return $proxyNames
}
# Example usage:
$computerNames = Get-ProxyNames
$systemInfoArray = foreach ($name in $computerNames) {
Get-RemoteSystemInfo -computerName $name
} | Format-Table -AutoSize
--
/* Veeam software enthusiast user & supporter ! */
/* Veeam software enthusiast user & supporter ! */
-
- Veeam Software
- Posts: 2015
- Liked: 671 times
- Joined: Sep 25, 2019 10:32 am
- Full Name: Oleg Feoktistov
- Contact:
Re: Retrieving the RAM and CPU of proxy servers using PowerShell
Hi,
There is an alternative way that doesn't involve querying WMI on a remote machine:
We write server hardware info to VBR DB, so we can obtain it directly.
Best regards,
Oleg
There is an alternative way that doesn't involve querying WMI on a remote machine:
Code: Select all
$proxies = Get-VBRViProxy
foreach ($proxy in $proxies) {
$physHost = $proxy.Host.GetPhysicalHost()
$proxy | select Name, @{n='HostName';e={$_.Host.Name}}, @{n='CPUCores';e={$physHost.Hardwareinfo.CoresCount}}, `
@{n='RAMInGB';e={[Math]::Round($physHost.HardwareInfo.PhysicalRAMTotal/1GB, 2)}}
}
Best regards,
Oleg
-
- Veteran
- Posts: 945
- Liked: 53 times
- Joined: Nov 05, 2009 12:24 pm
- Location: Sydney, NSW
- Contact:
Re: Retrieving the RAM and CPU of proxy servers using PowerShell
That's great, thank you @Oleg.
--
/* Veeam software enthusiast user & supporter ! */
/* Veeam software enthusiast user & supporter ! */
-
- Influencer
- Posts: 12
- Liked: 4 times
- Joined: May 29, 2024 2:47 pm
- Full Name: Vitalii Feshchenko
- Contact:
Re: Retrieving the RAM and CPU of proxy servers using PowerShell
Thanks @albertwt and @oleg.feoktistov
That is really what I wanted to know.
That is really what I wanted to know.
Who is online
Users browsing this forum: No registered users and 12 guests