Hi, this is ramana SV.
i wrote some script in WSH (sample.vbs), the intesion of the application is when i execute the program, i want other system details(RAM,Processor Speed, HDD,, Other's). But when i execute the program i got some error message That is"Permission denied "'GetObject'.
Below is MY Script CODE.
---------------------------------------------------------------------------------------------------------------------
strComputer = "mypc" 'system Name
'Set objWMIService = GetObject("winmgmts:"& "\\" & strComputer & "\root\cimv2")
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
'Set objComputer = GetObject("WinNT:\\" & strComputer & "Administrator")
Set colItems = objWMIService.ExecQuery("Select * from Win32_Account where Name = '" & Administrator& "'")
Set objNetwork = Wscript.CreateObject("Wscript.Network")
Set objStdOut = WScript.StdOut
Set colComputers =objWMIService.ExecQuery("Select * from Win32_ComputerSystem")
For Each objComputer in colComputers
objStdOut.WriteLine objNetwork.ComputerName
Wscript.Echo objComputer.Username
Wscript.Echo objComputer.TotalPhysicalMemory
' WScript.Echo " Processor Speed: " objComputer.ProcessorSpeed
' script.Echo objComputer.ComputerName
' Wscript.Echo " OSType: " objComputer.OSType
' Wscript.Echo objComputer.Manufacturer
Wscript.Echo objComputer.Model
' Wscript.Echo objComputer.NumberOfProcessors
Next
Set colItems = objWMIService.ExecQuery("Select * from Win32_Processor",,48)
For Each objItem in colItems
'objItem.PowerManagementSupported
Wscript.Echo "Processor Name & Speed: " & objItem.Name
'Wscript.Echo "ProcessorType: " & objItem.ProcessorType
objStdOut.Close
Next
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery("Select * from Win32_PhysicalMemory",,48)
For Each objItem in colItems
if objItem.Capacity > 900000000 and objItem.Capacity < 1900000000 then
amount = "1gb"
end if
if objItem.Capacity > 500000000 and objItem.Capacity < 900000000 then
amount = "512mb"
end if
if objItem.Capacity > 250000000 and objItem.Capacity < 500000000 then
amount = "256mb"
end if
if objItem.Capacity > 125000000 and objItem.Capacity < 250000000 then
amount = "128mb"
end if
if objItem.Capacity > 6200000 and objItem.Capacity < 125000000 then
amount = "64mb"
end if
if objItem.Capacity > 30000000 and objItem.Capacity < 62000000 then
amount = "32mb"
end if
wscript.echo(objItem.DeviceLocator & "RAM: " & amount & ", " & Speed & "")
Next
--------------------------------------------------------------------------------------------------------------------
pls Help me about this problem.
waitng 4 u r reply
Thank you
Ramanan SV