PC Review


Reply
Thread Tools Rate Thread

BAT file to retrieve Registry Setting

 
 
Bart Perrier
Guest
Posts: n/a
 
      9th Jun 2005
Can anyone help me with a BAT file to pull a String Value from HKLM\Software
and the computer name? I need to send a number of folks out to workstations
that are 95 machines. Rather than try to setup vbScript on each workstation,
I need to use a BAT file.

Thanks,
Bart Perrier


 
Reply With Quote
 
 
 
 
Mark V
Guest
Posts: n/a
 
      9th Jun 2005
In microsoft.public.win2000.cmdprompt.admin Bart Perrier wrote:

> Can anyone help me with a BAT file to pull a String Value from
> HKLM\Software and the computer name? I need to send a number of
> folks out to workstations that are 95 machines. Rather than try
> to setup vbScript on each workstation, I need to use a BAT file.


Does "that are 95 machines" mean they are Windows 95 OS? Or more
probably 95 machines running ???

What string value? Do you have the MS utility REG.EXE?

%COMPUTERNAME% may be sufficient for the computer name.
REG.EXE QUERY args
with subsequent FINDSTR filter, etc. ... Perhaps.

Also, if the systems are in a Domain you may be able to accomplish
the tasks remotely. Possibly utilizing PSEXEC.EXE (Sysinternals).
If not, then is the output to STDOUT, local file, network file? Will
the technicians be logged on locally (or a Domain) Administrators
account? A few more details will help.
 
Reply With Quote
 
Bart Perrier
Guest
Posts: n/a
 
      9th Jun 2005
Thanks for the reply Mark.

The key is HKLM\Software\Citrix\ICA Client\ --> ClientName and the
workstations are the infamous Windows 95 with a few Windows 98s.

I am not sure if these machines have reg.exe on them. If it is not a default
in Win 95, then probably not. I understand that BAT scripting is
considerably different than vbScripting, but is there a way to explicitly
say, "Give me the value at HKLM\Software\Citrix\ICA Client\ --> ClientName"?

I plan to setup a BAT file accessible on the network for each person to run
and then format the output in the COMMAND window with a PAUSE at the end so
they can write it down.

COMPUTERNAME - Computer1
CITRIX CLIENT NAME - CitrixClientName1

Ultimately, I would like to handle a likely NULL value or document what it
will look like. I plan to do this with a, hopefully simple, IF EXIST.

Thanks again Mark.

Bart Perrier

"Mark V" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> In microsoft.public.win2000.cmdprompt.admin Bart Perrier wrote:
>
> > Can anyone help me with a BAT file to pull a String Value from
> > HKLM\Software and the computer name? I need to send a number of
> > folks out to workstations that are 95 machines. Rather than try
> > to setup vbScript on each workstation, I need to use a BAT file.

>
> Does "that are 95 machines" mean they are Windows 95 OS? Or more
> probably 95 machines running ???
>
> What string value? Do you have the MS utility REG.EXE?
>
> %COMPUTERNAME% may be sufficient for the computer name.
> REG.EXE QUERY args
> with subsequent FINDSTR filter, etc. ... Perhaps.
>
> Also, if the systems are in a Domain you may be able to accomplish
> the tasks remotely. Possibly utilizing PSEXEC.EXE (Sysinternals).
> If not, then is the output to STDOUT, local file, network file? Will
> the technicians be logged on locally (or a Domain) Administrators
> account? A few more details will help.



 
Reply With Quote
 
Torgeir Bakken \(MVP\)
Guest
Posts: n/a
 
      9th Jun 2005
Bart Perrier wrote:

> Can anyone help me with a BAT file to pull a String Value from
> HKLM\Software and the computer name? I need to send a number of
> folks out to workstations that are 95 machines. Rather than try
> to setup vbScript on each workstation, I need to use a BAT file.

Hi,

If those Win95 computers have Internet Explorer 5.x installed, you
should have no problem using a VBScript for this.


--
torgeir, Microsoft MVP Scripting and WMI, Porsgrunn Norway
Administration scripting examples and an ONLINE version of
the 1328 page Scripting Guide:
http://www.microsoft.com/technet/scr...r/default.mspx
 
Reply With Quote
 
Mark V
Guest
Posts: n/a
 
      9th Jun 2005
In microsoft.public.win2000.cmdprompt.admin Bart Perrier wrote:

> "Mark V" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>> In microsoft.public.win2000.cmdprompt.admin Bart Perrier wrote:
>>
>> > Can anyone help me with a BAT file to pull a String Value
>> > from HKLM\Software and the computer name? I need to send a
>> > number of folks out to workstations that are 95 machines.
>> > Rather than try to setup vbScript on each workstation, I need
>> > to use a BAT file.

>>
>> Does "that are 95 machines" mean they are Windows 95 OS? Or
>> more probably 95 machines running ???

[ ]

> Thanks for the reply Mark.
>
> The key is HKLM\Software\Citrix\ICA Client\ --> ClientName and
> the workstations are the infamous Windows 95 with a few Windows
> 98s.
>
> I am not sure if these machines have reg.exe on them. If it is
> not a default in Win 95, then probably not. I understand that
> BAT scripting is considerably different than vbScripting, but is
> there a way to explicitly say, "Give me the value at
> HKLM\Software\Citrix\ICA Client\ --> ClientName"?
>
> I plan to setup a BAT file accessible on the network for each
> person to run and then format the output in the COMMAND window
> with a PAUSE at the end so they can write it down.
>
> COMPUTERNAME - Computer1
> CITRIX CLIENT NAME - CitrixClientName1


There is no system provided %COMPUTERNAME% in W95, so that is out.
Citrix "name" used to be (long time) stored in WFCNAME.INI, but I
suppose it is now a registry entry.

>
> Ultimately, I would like to handle a likely NULL value or
> document what it will look like. I plan to do this with a,
> hopefully simple, IF EXIST.

[ ]

Okay. It's been a long time since I've used Windows 95 (really
long <G>), but I can give you some ideas perhaps, even though this
group deals primarily with CMD.EXE on NTx systems.

Use regedit.exe to Export the Keys in question. If you are dealing
with string (REG_SZ) data this should not be too bad.
regedit.exe /x /a "<Drive:>\Directoy\FileName.reg" "KeyPath"
(You will need to confirm those switches exist in W95)

The other registry paths you probably want (confirm it) are:
(watch linewrap)
HKEY_LOCAL_MACHINE\System\CurrentControlSet\control\ComputerName
\ComputerName
"Computername"=
and possibly
HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\VxD\VNETSUP
"Computername"=

With command.com's limited facility for parsing, I'm not certain
what you can do other than filtering out the correct line using
FIND. Then perhaps redirect output to a file?

Hope that helps some.


 
Reply With Quote
 
Bart Perrier
Guest
Posts: n/a
 
      9th Jun 2005
Thanks for the help Mark and Torgeir.

I am going to confirm the vbScript capabilities with IE 5.x; all of the 9x
machines should have 5.5 on them. Plus, I will test the WINMGMTS connection.
A few years ago, I ruled out vbScripting with 9x because, if I remember
correctly, it required an install and I was primarily trying to run login
scripts via an NT4 Domain. Even with the install, it did not run the vb
Login Scripts on 9x.

We do not use the Computer Name for the Citrix Name on the majority of our
computers; at least the primary application that we run. Therefore, we
essentially force the Citrix Client to use to use the Reg Key to define the
name. For 2k and better OSes, I can scriptomatically retreive the
information remotely with an already familiar command (StdRegProv).

Again, thanks for your help. I think the desktop folks and their helpers
will have to do it the old fashioned way (Start -> Run -> Regedit...).

Thanks,
Bart "Let me write a script for that" Perrier

"Mark V" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> In microsoft.public.win2000.cmdprompt.admin Bart Perrier wrote:
>
> > "Mark V" <(E-Mail Removed)> wrote in message
> > news:(E-Mail Removed)...
> >> In microsoft.public.win2000.cmdprompt.admin Bart Perrier wrote:
> >>
> >> > Can anyone help me with a BAT file to pull a String Value
> >> > from HKLM\Software and the computer name? I need to send a
> >> > number of folks out to workstations that are 95 machines.
> >> > Rather than try to setup vbScript on each workstation, I need
> >> > to use a BAT file.
> >>
> >> Does "that are 95 machines" mean they are Windows 95 OS? Or
> >> more probably 95 machines running ???

> [ ]
>
> > Thanks for the reply Mark.
> >
> > The key is HKLM\Software\Citrix\ICA Client\ --> ClientName and
> > the workstations are the infamous Windows 95 with a few Windows
> > 98s.
> >
> > I am not sure if these machines have reg.exe on them. If it is
> > not a default in Win 95, then probably not. I understand that
> > BAT scripting is considerably different than vbScripting, but is
> > there a way to explicitly say, "Give me the value at
> > HKLM\Software\Citrix\ICA Client\ --> ClientName"?
> >
> > I plan to setup a BAT file accessible on the network for each
> > person to run and then format the output in the COMMAND window
> > with a PAUSE at the end so they can write it down.
> >
> > COMPUTERNAME - Computer1
> > CITRIX CLIENT NAME - CitrixClientName1

>
> There is no system provided %COMPUTERNAME% in W95, so that is out.
> Citrix "name" used to be (long time) stored in WFCNAME.INI, but I
> suppose it is now a registry entry.
>
> >
> > Ultimately, I would like to handle a likely NULL value or
> > document what it will look like. I plan to do this with a,
> > hopefully simple, IF EXIST.

> [ ]
>
> Okay. It's been a long time since I've used Windows 95 (really
> long <G>), but I can give you some ideas perhaps, even though this
> group deals primarily with CMD.EXE on NTx systems.
>
> Use regedit.exe to Export the Keys in question. If you are dealing
> with string (REG_SZ) data this should not be too bad.
> regedit.exe /x /a "<Drive:>\Directoy\FileName.reg" "KeyPath"
> (You will need to confirm those switches exist in W95)
>
> The other registry paths you probably want (confirm it) are:
> (watch linewrap)
> HKEY_LOCAL_MACHINE\System\CurrentControlSet\control\ComputerName
> \ComputerName
> "Computername"=
> and possibly
> HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\VxD\VNETSUP
> "Computername"=
>
> With command.com's limited facility for parsing, I'm not certain
> what you can do other than filtering out the correct line using
> FIND. Then perhaps redirect output to a file?
>
> Hope that helps some.
>
>



 
Reply With Quote
 
Torgeir Bakken \(MVP\)
Guest
Posts: n/a
 
      9th Jun 2005
Bart Perrier wrote:

> Thanks for the help Mark and Torgeir.
>
> I am going to confirm the vbScript capabilities with IE 5.x; all of the 9x
> machines should have 5.5 on them. Plus, I will test the WINMGMTS connection.

Hi,

You will not be able to use the winmgmts on Win9x computers (unless you have
installed the WMI Core 1.5 package on the computers).


Here is a VBScript you can try on the Win95 computers:

'--------------------8<----------------------

Set oWshNet = CreateObject("WScript.Network")
' get name of local computer
sMachineName = oWshNet.ComputerName

sCitrixClientName = RegRead("HKLM\Software\Citrix\ICA Client\ClientName")

sInfoMessage = "COMPUTERNAME: " & sMachineName & vbCrLf _
& "CITRIX CLIENT NAME: " & sCitrixClientName

MsgBox sInfoMessage, vbSystemModal+vbInformation, "Name check"


Function RegRead(sRegValue)
Set oShell = CreateObject("WScript.Shell")
On Error Resume Next
RegRead = oShell.RegRead(sRegValue)
' If the value does not exist, error is raised
If Err Then
RegRead = ""
Err.clear
End If
' If a value is present but uninitialized the RegRead method
' returns the input value in Win2k.
If VarType(RegRead) < vbArray Then
If RegRead = sRegValue Then
RegRead = ""
End If
End If
On Error Goto 0
End Function

'--------------------8<----------------------

--
torgeir, Microsoft MVP Scripting and WMI, Porsgrunn Norway
Administration scripting examples and an ONLINE version of
the 1328 page Scripting Guide:
http://www.microsoft.com/technet/scr...r/default.mspx
 
Reply With Quote
 
William Allen
Guest
Posts: n/a
 
      9th Jun 2005
"Bart Perrier" wrote in message
....snip
> The key is HKLM\Software\Citrix\ICA Client\ --> ClientName and the
> workstations are the infamous Windows 95 with a few Windows 98s.

....snip

The following Batch files is tested on a default Windows 95 installation,
it uses no third-party or non standard utilities. There was a dummy
string value loaded in a string key created in a key with the name you supply:
HKLM\Software\Citrix\ICA Client
"Some String Key"="Value of string"

Note the "quotes" around the registry path, these are essential
when a path contains [Space]s.

Lines that don't begin with two spaces have wrapped accidentally
====Begin cut-and-paste (omit this line)
@ECHO OFF
start /wait regedit /s /e %TEMP%.\KEY "HKEY_LOCAL_MACHINE\SOFTWARE\Citrix\ICA Client"
TYPE %TEMP%.\KEY | find "="
DEL %TEMP%.\KEY
ECHO.
CHOICE /c:y /n "Please copy value(s) above and press Y to close window "
CLS

====End cut-and-paste (omit this line)
For Win95/98/ME study/demo use. Cut-and-paste as plain-text Batch file.
Batch file troubleshooting: http://www.allenware.com/find?UsualSuspects

Screen capture shows operation:

============Screen capture Windows 95
C:\WORK>demo.bat
"Some String Key"="Value of string"

Please copy value(s) above and press Y to close window
============End screen capture

Assuming the user double-clicked the Batch file to run it,
they merely press Y to close the window after they've
copied down the result on whatever form you provide.

--
William Allen
Free interactive Batch Course http://www.allenware.com/icsw/icswidx.htm
Batch Reference with examples http://www.allenware.com/icsw/icswref.htm
Header email is rarely checked. Contact us at http://www.allenware.com/


 
Reply With Quote
 
Bart Perrier
Guest
Posts: n/a
 
      9th Jun 2005
Very, very nice. And I've seen you do that before.

I will test this on my typical 95 machine.

Thanks for your thoroughness, Torgeir.

Bart.


"Torgeir Bakken (MVP)" <Torgeir.Bakken-(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Bart Perrier wrote:
>
> > Thanks for the help Mark and Torgeir.
> >
> > I am going to confirm the vbScript capabilities with IE 5.x; all of the

9x
> > machines should have 5.5 on them. Plus, I will test the WINMGMTS

connection.
> Hi,
>
> You will not be able to use the winmgmts on Win9x computers (unless you

have
> installed the WMI Core 1.5 package on the computers).
>
>
> Here is a VBScript you can try on the Win95 computers:
>
> '--------------------8<----------------------
>
> Set oWshNet = CreateObject("WScript.Network")
> ' get name of local computer
> sMachineName = oWshNet.ComputerName
>
> sCitrixClientName = RegRead("HKLM\Software\Citrix\ICA Client\ClientName")
>
> sInfoMessage = "COMPUTERNAME: " & sMachineName & vbCrLf _
> & "CITRIX CLIENT NAME: " & sCitrixClientName
>
> MsgBox sInfoMessage, vbSystemModal+vbInformation, "Name check"
>
>
> Function RegRead(sRegValue)
> Set oShell = CreateObject("WScript.Shell")
> On Error Resume Next
> RegRead = oShell.RegRead(sRegValue)
> ' If the value does not exist, error is raised
> If Err Then
> RegRead = ""
> Err.clear
> End If
> ' If a value is present but uninitialized the RegRead method
> ' returns the input value in Win2k.
> If VarType(RegRead) < vbArray Then
> If RegRead = sRegValue Then
> RegRead = ""
> End If
> End If
> On Error Goto 0
> End Function
>
> '--------------------8<----------------------
>
> --
> torgeir, Microsoft MVP Scripting and WMI, Porsgrunn Norway
> Administration scripting examples and an ONLINE version of
> the 1328 page Scripting Guide:
> http://www.microsoft.com/technet/scr...r/default.mspx



 
Reply With Quote
 
Reinhardt Kern
Guest
Posts: n/a
 
      9th Jun 2005
"Bart Perrier" <(E-Mail Removed)> wrote:

>Can anyone help me with a BAT file to pull a String Value from HKLM\Software
>and the computer name? I need to send a number of folks out to workstations
>that are 95 machines. Rather than try to setup vbScript on each workstation,
>I need to use a BAT file.
>

Hi Bart,

the Win95 batch language is poor. Because of this there exist a
huge bunch of batch enhancers.

Years ago I preferred Kixtart (see http://www.kixtart.org )
This tiny script was designed for logon scripting.
It specialty is registry editing and ini file editing.

You find literally 1000s of examples in
http://www.kixtart.org/ubbthreads/ubbthreads.php?Cat=


Did you already try the use of remote registry?
Try the following from your WinXP box:

reg query \\win95box\HKLM\Software

IIRC the HKLM key should be open for reading.


Reinhardt
--
Die Katzen sind Wörter mit Pelz. Wie die Wörter, so streifen sie um die
Menschen herum, ohne sich je zähmen zu lassen. Wörter und Katzen gehören
zur Rasse der Nichtgreifbaren. [Erik Orsenna]
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Need registry setting to show file extensions ToddAndMargo Windows XP General 32 9th Aug 2009 05:12 AM
Retrieve File Icon from Registry mphanke Microsoft C# .NET 6 3rd Nov 2004 03:36 AM
Setting up Local policies through registry file? Possible? Help please! MP Microsoft Windows 2000 Registry 1 13th Jan 2004 02:11 PM
Setting up Local policies through registry file? Possible? Help please! MP Microsoft Windows 2000 Registry Archive 2 13th Jan 2004 02:11 PM
Setting up Local policies through registry file? Possible? Help please! MP Microsoft Windows 2000 Registry Archive 0 12th Jan 2004 11:14 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:27 AM.