![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| | winmgmts not working on some servers Hi, I wrote a script to set Tab Complition up on a list of servers. It works on some and not on others. Seems that winmgmts is not working on some of my servers. I beleive that they are Windows 2000. I seem to recall that WMI had to be instlled on some older boxes, but I can't recall how or where I would get the software. Here is my script; Dim strComputer Dim objWMIService Dim SWBemlocator Dim UserName Dim Password Dim Title, Text1, Text2 Dim Message, result Title = "Add Tab Complition" Text1 = "User Input Cancelled" Text2 = "You Entered: " & vbTab ' Define Msg Box Var Message = "PLease Enter Server Name" result = InputBox(Message, Title, "Type Server Name Here", 100, 100) ' Evaluate the user input. If result = "" Then WScript.Echo Text1 WScript.Quit Else WScript.Echo Text2 & result & " Please wait" End If strComputer = result ' Add Tab Compition Set WshShell = WScript.CreateObject("WScript.Shell") Set SWBemlocator = CreateObject("WbemScripting.SWbemLocator") Set objWMIService = SWBemlocator.ConnectServer(strComputer,"\root \CIMV2") SetTabComplete(strComputer) Sub SetTabComplete(strComputer) ' Use to configure Tab Complition ' provide system name Dim sPath, oReg Const HKLM = &H80000002 sPath = "\SOFTWARE\Microsoft\Command Processor" Set oReg = GetObject("winmgmts:\\" & "{impersonationLevel=impersonate}!\\" _ & strComputer & "\root\default:StdRegProv") oReg.SetStringValue HKLM, sPath,"AutoRun"="" oReg.SetStringValue HKLM, sPath,"CompletionChar",9 oReg.SetStringValue HKLM, sPath,"DefaultColor",0 oReg.SetStringValue HKLM, sPath,"EnableExtensions",1 oReg.SetStringValue HKLM, sPath,"PathCompletionChar",40 End Sub And here is the error: C:\WINDOWS\system32>G:\Scripts\AddTabComplition.vbs Microsoft (R) Windows Script Host Version 5.7 Copyright (C) Microsoft Corporation. All rights reserved. You Entered: Parrot Please wait G:\Scripts\AddTabComplition.vbs(49, 3) (null): 0x80041021 OldDog |
My System Specs![]() |
| | #2 (permalink) |
| | Re: winmgmts not working on some servers "OldDog" <mikef2691@xxxxxx> wrote in message news:718e3d03-43b6-4473-a847-85ea68c2ce5e@xxxxxx Quote: > Hi, > > I wrote a script to set Tab Complition up on a list of servers. It > works on some and not on others. > > Seems that winmgmts is not working on some of my servers. I beleive > that they are Windows 2000. > > I seem to recall that WMI had to be instlled on some older boxes, but > I can't recall how or where I would get the software. > > Here is my script; > > Dim strComputer > Dim objWMIService > Dim SWBemlocator > Dim UserName > Dim Password > Dim Title, Text1, Text2 > Dim Message, result > Title = "Add Tab Complition" > Text1 = "User Input Cancelled" > Text2 = "You Entered: " & vbTab > > ' Define Msg Box Var > Message = "PLease Enter Server Name" > result = InputBox(Message, Title, "Type Server Name Here", 100, 100) > ' Evaluate the user input. > If result = "" Then > WScript.Echo Text1 > WScript.Quit > Else > WScript.Echo Text2 & result & " Please wait" > End If > > strComputer = result > ' Add Tab Compition > Set WshShell = WScript.CreateObject("WScript.Shell") > Set SWBemlocator = CreateObject("WbemScripting.SWbemLocator") > Set objWMIService = SWBemlocator.ConnectServer(strComputer,"\root > \CIMV2") > > SetTabComplete(strComputer) > > Sub SetTabComplete(strComputer) > ' Use to configure Tab Complition > ' provide system name > Dim sPath, oReg > Const HKLM = &H80000002 > sPath = "\SOFTWARE\Microsoft\Command Processor" > Set oReg = GetObject("winmgmts:\\" & > "{impersonationLevel=impersonate}!\\" _ > & strComputer & "\root\default:StdRegProv") > oReg.SetStringValue HKLM, sPath,"AutoRun"="" > oReg.SetStringValue HKLM, sPath,"CompletionChar",9 > oReg.SetStringValue HKLM, sPath,"DefaultColor",0 > oReg.SetStringValue HKLM, sPath,"EnableExtensions",1 > oReg.SetStringValue HKLM, sPath,"PathCompletionChar",40 > > > End Sub > > > And here is the error: > > C:\WINDOWS\system32>G:\Scripts\AddTabComplition.vbs > Microsoft (R) Windows Script Host Version 5.7 > Copyright (C) Microsoft Corporation. All rights reserved. > > You Entered: Parrot Please wait > G:\Scripts\AddTabComplition.vbs(49, 3) (null): 0x80041021 > > OldDog clients. I use code similar to: strComputer = "pc_name" Set objWMIService = GetObject("winmgmts:" _ & "{impersonationLevel=impersonate,authenticationLevel=Pkt}!\\" _ & strComputer & "\root\default:StdRegProv") I have never used SWbemLocator to make the connnection. Things I found investigating problems: 1. You cannot connect to computer running XP Home. 2. An NT computer cannot connect to OS later than W2k. 3. A W2k3 computer cannot connect to Win9x. 4. To connect to W2k Server SP4 you must set impersonation level to Impersonate. 5. W2k computers must have SP2 to connect to XP or above. 6. W2k3 can only connect to Win9x and NT if credentials supplied. 7. To connect to XP or W2k3 you should set authentication level to Pkt. I use the following links for troubleshooting: http://www.microsoft.com/technet/scr.../help/wmi.mspx http://support.microsoft.com/kb/875605 http://www.microsoft.com/technet/scr...es/wmifaq.mspx WMI can become corrupt. You can rebuild the WMI repository, if you have XP SP2, with the command: rundll32 wbemupgd, UpgradeRepository The following commands reinstall WMI in the registry: winmgmt /clearadap winmgmt /kill winmgmt /unregserver winmgmt /regserver winmgmt /resyncperf The following command enables remote access in the firewall: netsh firewall set service remoteadmin enable -- Richard Mueller MVP Directory Services Hilltop Lab - http://www.rlmueller.net -- |
My System Specs![]() |
| | #3 (permalink) |
| | Re: winmgmts not working on some servers "Richard Mueller [MVP]" wrote: Quote: > > "OldDog" <mikef2691@xxxxxx> wrote in message > news:718e3d03-43b6-4473-a847-85ea68c2ce5e@xxxxxx Quote: > > Hi, > > > > I wrote a script to set Tab Complition up on a list of servers. It > > works on some and not on others. > > > > Seems that winmgmts is not working on some of my servers. I beleive > > that they are Windows 2000. > > > > I seem to recall that WMI had to be instlled on some older boxes, but > > I can't recall how or where I would get the software. > > > > Here is my script; > > > > Dim strComputer > > Dim objWMIService > > Dim SWBemlocator > > Dim UserName > > Dim Password > > Dim Title, Text1, Text2 > > Dim Message, result > > Title = "Add Tab Complition" > > Text1 = "User Input Cancelled" > > Text2 = "You Entered: " & vbTab > > > > ' Define Msg Box Var > > Message = "PLease Enter Server Name" > > result = InputBox(Message, Title, "Type Server Name Here", 100, 100) > > ' Evaluate the user input. > > If result = "" Then > > WScript.Echo Text1 > > WScript.Quit > > Else > > WScript.Echo Text2 & result & " Please wait" > > End If > > > > strComputer = result > > ' Add Tab Compition > > Set WshShell = WScript.CreateObject("WScript.Shell") > > Set SWBemlocator = CreateObject("WbemScripting.SWbemLocator") > > Set objWMIService = SWBemlocator.ConnectServer(strComputer,"\root > > \CIMV2") > > > > SetTabComplete(strComputer) > > > > Sub SetTabComplete(strComputer) > > ' Use to configure Tab Complition > > ' provide system name > > Dim sPath, oReg > > Const HKLM = &H80000002 > > sPath = "\SOFTWARE\Microsoft\Command Processor" > > Set oReg = GetObject("winmgmts:\\" & > > "{impersonationLevel=impersonate}!\\" _ > > & strComputer & "\root\default:StdRegProv") > > oReg.SetStringValue HKLM, sPath,"AutoRun"="" > > oReg.SetStringValue HKLM, sPath,"CompletionChar",9 > > oReg.SetStringValue HKLM, sPath,"DefaultColor",0 > > oReg.SetStringValue HKLM, sPath,"EnableExtensions",1 > > oReg.SetStringValue HKLM, sPath,"PathCompletionChar",40 > > > > > > End Sub > > > > > > And here is the error: > > > > C:\WINDOWS\system32>G:\Scripts\AddTabComplition.vbs > > Microsoft (R) Windows Script Host Version 5.7 > > Copyright (C) Microsoft Corporation. All rights reserved. > > > > You Entered: Parrot Please wait > > G:\Scripts\AddTabComplition.vbs(49, 3) (null): 0x80041021 > > > > OldDog > WMI comes with all OS's from Windows 2000 on. It can be installed on earlier > clients. I use code similar to: > > strComputer = "pc_name" > Set objWMIService = GetObject("winmgmts:" _ > & "{impersonationLevel=impersonate,authenticationLevel=Pkt}!\\" _ > & strComputer & "\root\default:StdRegProv") > > I have never used SWbemLocator to make the connnection. Things I found > investigating problems: > > 1. You cannot connect to computer running XP Home. > 2. An NT computer cannot connect to OS later than W2k. > 3. A W2k3 computer cannot connect to Win9x. > 4. To connect to W2k Server SP4 you must set impersonation level to > Impersonate. > 5. W2k computers must have SP2 to connect to XP or above. > 6. W2k3 can only connect to Win9x and NT if credentials supplied. > 7. To connect to XP or W2k3 you should set authentication level to Pkt. > > I use the following links for troubleshooting: > > http://www.microsoft.com/technet/scr.../help/wmi.mspx > > http://support.microsoft.com/kb/875605 > > http://www.microsoft.com/technet/scr...es/wmifaq.mspx > > WMI can become corrupt. You can rebuild the WMI repository, if you have XP > SP2, with the command: > > rundll32 wbemupgd, UpgradeRepository > > The following commands reinstall WMI in the registry: > > winmgmt /clearadap > winmgmt /kill > winmgmt /unregserver > winmgmt /regserver > winmgmt /resyncperf > > The following command enables remote access in the firewall: > > netsh firewall set service remoteadmin enable > > -- > Richard Mueller > MVP Directory Services > Hilltop Lab - http://www.rlmueller.net > -- > > > Even if I test the script locally I get the same error (0x80041021). The error points to this line: Set oReg = GetObject("winmgmts:\\" & "{impersonationLevel=impersonate}!\\" _ & strComputer & "\root\default:StdRegProv") The script executes when I remove the two backslashes after the winmgmts moniker: Set oReg = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" _ & strComputer & "\root\default:StdRegProv") I tested this on Windows XP SP3. If the entire script is shown, I don't think there is a need to use SWbemLocator because objWMIService is never used. -- urkec |
My System Specs![]() |
| | #4 (permalink) |
| | Re: winmgmts not working on some servers "urkec" <urkec@xxxxxx> wrote in message news:BDCBFE59-FEC2-40DA-90ED-17E2B3B81C11@xxxxxx Quote: > "Richard Mueller [MVP]" wrote: > Quote: >> >> "OldDog" <mikef2691@xxxxxx> wrote in message >> news:718e3d03-43b6-4473-a847-85ea68c2ce5e@xxxxxx Quote: >> > Hi, >> > >> > I wrote a script to set Tab Complition up on a list of servers. It >> > works on some and not on others. >> > >> > Seems that winmgmts is not working on some of my servers. I beleive >> > that they are Windows 2000. >> > >> > I seem to recall that WMI had to be instlled on some older boxes, but >> > I can't recall how or where I would get the software. >> > >> > Here is my script; >> > >> > Dim strComputer >> > Dim objWMIService >> > Dim SWBemlocator >> > Dim UserName >> > Dim Password >> > Dim Title, Text1, Text2 >> > Dim Message, result >> > Title = "Add Tab Complition" >> > Text1 = "User Input Cancelled" >> > Text2 = "You Entered: " & vbTab >> > >> > ' Define Msg Box Var >> > Message = "PLease Enter Server Name" >> > result = InputBox(Message, Title, "Type Server Name Here", 100, 100) >> > ' Evaluate the user input. >> > If result = "" Then >> > WScript.Echo Text1 >> > WScript.Quit >> > Else >> > WScript.Echo Text2 & result & " Please wait" >> > End If >> > >> > strComputer = result >> > ' Add Tab Compition >> > Set WshShell = WScript.CreateObject("WScript.Shell") >> > Set SWBemlocator = CreateObject("WbemScripting.SWbemLocator") >> > Set objWMIService = SWBemlocator.ConnectServer(strComputer,"\root >> > \CIMV2") >> > >> > SetTabComplete(strComputer) >> > >> > Sub SetTabComplete(strComputer) >> > ' Use to configure Tab Complition >> > ' provide system name >> > Dim sPath, oReg >> > Const HKLM = &H80000002 >> > sPath = "\SOFTWARE\Microsoft\Command Processor" >> > Set oReg = GetObject("winmgmts:\\" & >> > "{impersonationLevel=impersonate}!\\" _ >> > & strComputer & "\root\default:StdRegProv") >> > oReg.SetStringValue HKLM, sPath,"AutoRun"="" >> > oReg.SetStringValue HKLM, sPath,"CompletionChar",9 >> > oReg.SetStringValue HKLM, sPath,"DefaultColor",0 >> > oReg.SetStringValue HKLM, sPath,"EnableExtensions",1 >> > oReg.SetStringValue HKLM, sPath,"PathCompletionChar",40 >> > >> > >> > End Sub >> > >> > >> > And here is the error: >> > >> > C:\WINDOWS\system32>G:\Scripts\AddTabComplition.vbs >> > Microsoft (R) Windows Script Host Version 5.7 >> > Copyright (C) Microsoft Corporation. All rights reserved. >> > >> > You Entered: Parrot Please wait >> > G:\Scripts\AddTabComplition.vbs(49, 3) (null): 0x80041021 >> > >> > OldDog >> WMI comes with all OS's from Windows 2000 on. It can be installed on >> earlier >> clients. I use code similar to: >> >> strComputer = "pc_name" >> Set objWMIService = GetObject("winmgmts:" _ >> & "{impersonationLevel=impersonate,authenticationLevel=Pkt}!\\" _ >> & strComputer & "\root\default:StdRegProv") >> >> I have never used SWbemLocator to make the connnection. Things I found >> investigating problems: >> >> 1. You cannot connect to computer running XP Home. >> 2. An NT computer cannot connect to OS later than W2k. >> 3. A W2k3 computer cannot connect to Win9x. >> 4. To connect to W2k Server SP4 you must set impersonation level to >> Impersonate. >> 5. W2k computers must have SP2 to connect to XP or above. >> 6. W2k3 can only connect to Win9x and NT if credentials supplied. >> 7. To connect to XP or W2k3 you should set authentication level to Pkt. >> >> I use the following links for troubleshooting: >> >> http://www.microsoft.com/technet/scr.../help/wmi.mspx >> >> http://support.microsoft.com/kb/875605 >> >> http://www.microsoft.com/technet/scr...es/wmifaq.mspx >> >> WMI can become corrupt. You can rebuild the WMI repository, if you have >> XP >> SP2, with the command: >> >> rundll32 wbemupgd, UpgradeRepository >> >> The following commands reinstall WMI in the registry: >> >> winmgmt /clearadap >> winmgmt /kill >> winmgmt /unregserver >> winmgmt /regserver >> winmgmt /resyncperf >> >> The following command enables remote access in the firewall: >> >> netsh firewall set service remoteadmin enable >> >> -- >> Richard Mueller >> MVP Directory Services >> Hilltop Lab - http://www.rlmueller.net >> -- >> >> >> > > Even if I test the script locally I get the same error (0x80041021). The > error points to this line: > > Set oReg = GetObject("winmgmts:\\" & "{impersonationLevel=impersonate}!\\" > _ > & strComputer & "\root\default:StdRegProv") > > The script executes when I remove the two backslashes after the winmgmts > moniker: > > Set oReg = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" _ > & strComputer & "\root\default:StdRegProv") > > I tested this on Windows XP SP3. If the entire script is shown, I don't > think there is a need to use SWbemLocator because objWMIService is never > used. > > > -- > urkec symbol. -- Richard Mueller MVP Directory Services Hilltop Lab - http://www.rlmueller.net -- |
My System Specs![]() |
| | #5 (permalink) |
| | Re: winmgmts not working on some servers On Oct 10, 11:58*am, urkec <ur...@xxxxxx> wrote: Quote: > "Richard Mueller [MVP]" wrote: > Quote: > > "OldDog" <mikef2...@xxxxxx> wrote in message > >news:718e3d03-43b6-4473-a847-85ea68c2ce5e@xxxxxx Quote: > > > Hi, Quote: Quote: > > > I wrote a script to set Tab Complition up on a list of servers. It > > > works on some and not on others. Quote: Quote: > > > Seems that winmgmts is not working on some of my servers. I beleive > > > that they are Windows 2000. Quote: Quote: > > > I seem to recall that WMI had to be instlled on some older boxes, but > > > I can't recall how or where I would get the software. Quote: Quote: > > > Here is my script; Quote: Quote: > > > Dim strComputer > > > Dim objWMIService > > > Dim SWBemlocator > > > Dim UserName > > > Dim Password > > > Dim Title, Text1, Text2 > > > Dim Message, result > > > Title = "Add Tab Complition" > > > Text1 = "User Input Cancelled" > > > Text2 = "You Entered: " & vbTab Quote: Quote: > > > ' Define Msg Box Var > > > Message = "PLease Enter Server Name" > > > result = InputBox(Message, Title, "Type Server Name Here", 100, 100) > > > ' Evaluate the user input. > > > If result = "" Then > > > WScript.Echo Text1 > > > WScript.Quit > > > Else > > > WScript.Echo Text2 & result & " Please wait" > > > End If Quote: Quote: > > > strComputer = result > > > ' Add Tab Compition > > > Set WshShell = WScript.CreateObject("WScript.Shell") > > > Set SWBemlocator = CreateObject("WbemScripting.SWbemLocator") > > > Set objWMIService = SWBemlocator.ConnectServer(strComputer,"\root > > > \CIMV2") Quote: Quote: > > > SetTabComplete(strComputer) Quote: Quote: > > > Sub SetTabComplete(strComputer) > > > *' Use to configure Tab Complition > > > *' provide system name > > > *Dim sPath, oReg > > > *Const HKLM = &H80000002 > > > *sPath = "\SOFTWARE\Microsoft\Command Processor" > > > *Set oReg = GetObject("winmgmts:\\" & > > > "{impersonationLevel=impersonate}!\\" *_ > > > * & strComputer & "\root\default:StdRegProv") > > > *oReg.SetStringValue HKLM, sPath,"AutoRun"="" > > > oReg.SetStringValue HKLM, sPath,"CompletionChar",9 > > > oReg.SetStringValue HKLM, sPath,"DefaultColor",0 > > > oReg.SetStringValue HKLM, sPath,"EnableExtensions",1 > > > oReg.SetStringValue HKLM, sPath,"PathCompletionChar",40 Quote: Quote: > > > End Sub Quote: Quote: > > > And here is the error: Quote: Quote: > > > C:\WINDOWS\system32>G:\Scripts\AddTabComplition.vbs > > > Microsoft (R) Windows Script Host Version 5.7 > > > Copyright (C) Microsoft Corporation. All rights reserved. Quote: Quote: > > > You Entered: * *Parrot Please wait > > > G:\Scripts\AddTabComplition.vbs(49, 3) (null): 0x80041021 Quote: Quote: > > > OldDog Quote: > > WMI comes with all OS's from Windows 2000 on. It can be installed on earlier > > clients. I use code similar to: Quote: > > strComputer = "pc_name" > > Set objWMIService = GetObject("winmgmts:" _ > > * * & "{impersonationLevel=impersonate,authenticationLevel=Pkt}!\\" _ > > * * & strComputer & "\root\default:StdRegProv") Quote: > > I have never used SWbemLocator to make the connnection. Things I found > > investigating problems: Quote: > > 1. You cannot connect to computer running XP Home. > > 2. An NT computer cannot connect to OS later than W2k. > > 3. A W2k3 computer cannot connect to Win9x. > > 4. To connect to W2k Server SP4 you must set impersonation level to > > Impersonate. > > 5. W2k computers must have SP2 to connect to XP or above. > > 6. W2k3 can only connect to Win9x and NT if credentials supplied. > > 7. To connect to XP or W2k3 you should set authentication level to Pkt. Quote: > > I use the following links for troubleshooting: Quote: Quote: > > WMI can *become corrupt. You can rebuild the WMI repository, if you have XP > > SP2, with the command: Quote: > > rundll32 wbemupgd, UpgradeRepository Quote: > > The following commands reinstall WMI in the registry: Quote: > > winmgmt /clearadap > > winmgmt /kill > > winmgmt /unregserver > > winmgmt /regserver > > winmgmt /resyncperf Quote: > > The following command enables remote access in the firewall: Quote: > > netsh firewall set service remoteadmin enable Quote: > > -- > > Richard Mueller > > MVP Directory Services > > Hilltop Lab -http://www.rlmueller.net > > -- > Even if I test the script locally I get the same error (0x80041021). The > error points to this line: > > Set oReg = GetObject("winmgmts:\\" & "{impersonationLevel=impersonate}!\\" _ > & strComputer & "\root\default:StdRegProv") > > The script executes when I remove the two backslashes after the winmgmts > moniker: > > Set oReg = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" _ > & strComputer & "\root\default:StdRegProv") > > I tested this on Windows XP SP3. If the entire script is shown, I don't > think there is a need to use SWbemLocator because objWMIService is never used. > > -- > urkec- Hide quoted text - > > - Show quoted text - Thanks for all your help. OldDog |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| access denied on a remote computer with winmgmts | VB Script | |||
| 00:21EST and servers are working again | Live Mail | |||
| Trouble with winmgmts in vbs... | VB Script | |||
| How to terminate a Win32 process without using "winmgmts:" | VB Script | |||
| WGA validation suddenly not working with Windows Servers. | Vista General | |||