lauraSatellite
Technical User
I am relatively new to vbscript. I am trying to retrieve the RAM in mb for a server. I enter the server name in the code, and use the following code to retrieve the ram:
GetServerInfo Array("servername"), "C:\SRVINFO.CSV", ","
Sub GetServerInfo(aServers, sFileName, sDel)
set oFSO = CreateObject("Scripting.FileSystemObject")
set oText = oFSO.CreateTextFile("Path\Results.txt")
columns = "sServer" & "," & "RAM"
oText.WriteLine columns
for each sServer in aServers
Set objWMIService = GetObject("WINMGTS" & sServer & "ROOT")
Set ColMemory = objWMIService.ExecQuery _
("select * from Win32_CacheMemory")
for each mem in ColMemory
Memory = "," & Trim(mem.Caption)
Next
INV = sServer & Memory
oText.Writeline INV
Next
End Sub
This code returns "Cache Memory" as the RAM field. I have tried getting a number of other variables within Win32_CacheMemory, but i have been unable to find the correct variable. If you know what i should be calling other than Win32_CacheMemory.Caption, i would really appreciate it if you could let me know. Thanks in advance.
GetServerInfo Array("servername"), "C:\SRVINFO.CSV", ","
Sub GetServerInfo(aServers, sFileName, sDel)
set oFSO = CreateObject("Scripting.FileSystemObject")
set oText = oFSO.CreateTextFile("Path\Results.txt")
columns = "sServer" & "," & "RAM"
oText.WriteLine columns
for each sServer in aServers
Set objWMIService = GetObject("WINMGTS" & sServer & "ROOT")
Set ColMemory = objWMIService.ExecQuery _
("select * from Win32_CacheMemory")
for each mem in ColMemory
Memory = "," & Trim(mem.Caption)
Next
INV = sServer & Memory
oText.Writeline INV
Next
End Sub
This code returns "Cache Memory" as the RAM field. I have tried getting a number of other variables within Win32_CacheMemory, but i have been unable to find the correct variable. If you know what i should be calling other than Win32_CacheMemory.Caption, i would really appreciate it if you could let me know. Thanks in advance.