Hi,
I am trying to write a script to stop services automatically in a Windows server 2003 R2. i am having a text file with the server name and services name and use the concept of array for stopping all the services.,
Sample script as follows,
Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & splitArray(0) & "\root\cimv2") 'Computer name
Set colItems = objWMIService.ExecQuery("Select * from Win32_Service where DisplayName = '" & splitArray(1) & "'") 'Service name
For Each objItem in colItems
But when i execute the script from the 32-bit server i get the error,
Microsoft VBScript Runtime error (at the line For loop in the script): ActiveX component can't create the object.
When i tried to execute the same script from 64-bit server , i get the error,
Errorermission Denied 'GetObject'
Source:Microsoft VBScript Runtime error
Code:800A0046
Can someone please help me out
I am trying to write a script to stop services automatically in a Windows server 2003 R2. i am having a text file with the server name and services name and use the concept of array for stopping all the services.,
Sample script as follows,
Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & splitArray(0) & "\root\cimv2") 'Computer name
Set colItems = objWMIService.ExecQuery("Select * from Win32_Service where DisplayName = '" & splitArray(1) & "'") 'Service name
For Each objItem in colItems
But when i execute the script from the 32-bit server i get the error,
Microsoft VBScript Runtime error (at the line For loop in the script): ActiveX component can't create the object.
When i tried to execute the same script from 64-bit server , i get the error,
Errorermission Denied 'GetObject'
Source:Microsoft VBScript Runtime error
Code:800A0046
Can someone please help me out