"OldDog" <mikef2691@xxxxxx> wrote in message
news:718e3d03-43b6-4473-a847-85ea68c2ce5e@xxxxxx
> 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
--