Re: Reading Registry



On May 30, 1:30 pm, "Richard Mueller [MVP]" <rlmueller-
nos...@xxxxxxxxxxxxxxxxxxxx> wrote:
"Gaurav" <gaurav...@xxxxxxxxx> wrote in message

news:1180545201.802600.215610@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Thanks Richard,

What I am still confused about is" Why do i still get the some blank
outputs(quite a few)?"
If winmgmts is case sensitive ..i should get a common output
reagrdless of using it correctly or not.

Thanks
Gaurav

You are right that if "winmgmts" were case sensitive, it would always raise
an error. The monikers "LDAP" and "WinNT" are case sensitive, so I assumed
"winmgmts" was as well. Testing reveals I was wrong, "winmgmts" is case
insensitive.

One problem is that compname() is not defined in the snippet you provided.
The program seems to work for me if I substitute strComputer for compname(),
and assign my computer name to strComputer (rather than "."). I also
substituted valid values for xxxx and yyy

If an error is raised, it will not be revealed in the text file created by
the script. If "On Error Resume Next" is used and an error is raised, the
file is not created. I cannot think of a scenario where the file will be
created with no string written to it.

If this is run as a logon script, you can retrieve the computer name from
the wshNetwork object:

Set objNetwork = CreateObject("Wscript.Network")
strComputer = objNetwork.ComputerName

Does the script work on the machines where it failed if you run the script
manually at a command prompt after logon? Is there something in common about
the computers where the script fails, like the OS? When it fails, is the
text file created with nothing, or is no file created?

--
Richard Mueller
Microsoft MVP Scripting and ADSI
Hilltop Lab -http://www.rlmueller.net
--

Yes, that is a part of login script. Login script captures a lot more
data like OS, machine name, logged on user etc and writes to
individual text files which are comma delimeted. So the text file is
always created even if LNVer() doesn't work.
I will have to find out the location of the computers it is failing
on. I will investigate further and post my findings.

Thanks again
Gaurav

.



Relevant Pages

  • Re: Reading Registry
    ... You are right that if "winmgmts" were case sensitive, ... The program seems to work for me if I substitute strComputer for compname, ... If this is run as a logon script, you can retrieve the computer name from ... the computers where the script fails, ...
    (microsoft.public.scripting.vbscript)
  • Trouble with winmgmts in vbs...
    ... I've got a script that goes out and reads registry keys on computers ... from the first machine. ... The strComputer variable changes just fine as the script moves through ... for some reason the winmgmts command doesn't want to ...
    (microsoft.public.scripting.vbscript)
  • Re: Need Help..
    ... strComputer, strName, strModel, etc. works, then I can only guess the ... this part of the script is working. ... The part where we must add disconnected computers to the database i can't ... Dim strComputerName ' The Computer Name to be queried via WMI ...
    (microsoft.public.windows.server.scripting)
  • Re: Loop with out Do
    ... Set objLog = ... & vbNewLine & vbNewLine ... Also, strComputer will never be False, but ... When I fixed the problems in the second script, ...
    (microsoft.public.windows.server.scripting)
  • Re: VBScript and Out Put to Excel Worksheet
    ... removed them from the list and now the script works. ... Dim strComputer, strDN ... On Error GoTo 0 ...
    (microsoft.public.windows.server.scripting)