registrywritekey problem

Technical support and scripting issues

Moderators: JRL, Dorian (MJT support)

Post Reply
petersa2
Newbie
Posts: 9
Joined: Thu Mar 13, 2003 8:27 pm

registrywritekey problem

Post by petersa2 » Wed May 28, 2003 11:15 pm

Can I use registrywritekey> to write a numeric string value?

I want to configure the change HKEY_LOCAL_MACHINE,SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\forceautologon to 1, but the following command creates a dword value rather than a string value, which doesn't work.

RegistryWriteKey>HKEY_LOCAL_MACHINE,SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon,forceautologon,1

I can have MS execute a reg file to accomplish this, but I'd rather not.
Thanks for the help.

User avatar
Bob Hansen
Automation Wizard
Posts: 2475
Joined: Tue Sep 24, 2002 3:47 am
Location: Salem, New Hampshire, US
Contact:

Post by Bob Hansen » Thu May 29, 2003 12:56 am

Hi petersa2.....

There is a MS variable to let REGistry INTegers be written AS a STRing.

Try this:

Let>REG_INTASSTR=1

RegistryWriteKey>HKEY_LOCAL_MACHINE,SOFTWARE\Microsoft\WindowsNT\CurrentVersion\Winlogon,forceautologon,1


Hope this helps.....good luck....
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!

petersa2
Newbie
Posts: 9
Joined: Thu Mar 13, 2003 8:27 pm

Thanks

Post by petersa2 » Thu May 29, 2003 12:10 pm

Works great. Thanks for the help.

User avatar
CyberCitizen
Automation Wizard
Posts: 724
Joined: Sun Jun 20, 2004 7:06 am
Location: Adelaide, South Australia

Post by CyberCitizen » Mon Feb 28, 2005 1:24 am

Is There A Way When Writing Into The Registry That You Can Specify What Value The Registry Key Should Be.

REG_DWORD
REG_SZ
REG_BINARY


I Am Currently Wanting To Enter Some Data Into The Registry Via A Macro Which I Will Convert To An Exe & Have The System Deploy It.

The Data I Want To Add Is Below.

Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Desktop\Components\0]
"Source"="\\Emfile0009c02\strve-f03$\BFS\SATELLITE\L2 BOH\Allen, Michael John\BigPond\BP.htm"
"SubscribedURL"="\\Emfile0009c02\strve-f03$\BFS\SATELLITE\L2 BOH\Allen, Michael John\BigPond\BP.htm"
"FriendlyName"=""
"Flags"=dword:00002002
"Position"=hex:2c,00,00,00,00,00,00,00,00,00,00,00,00,04,00,00,e4,02,00,00,00,\
00,00,00,01,00,00,00,01,00,00,00,01,00,00,00,00,00,00,00,00,00,00,00
"CurrentState"=dword:40000002
"OriginalStateInfo"=hex:18,00,00,00,00,00,00,00,00,00,00,00,00,04,00,00,e4,02,\
00,00,02,00,00,40
"RestoredStateInfo"=hex:18,00,00,00,00,00,00,00,00,00,00,00,00,04,00,00,e4,02,\
00,00,01,00,00,00

I Am Wanting To Be Able To Enter The Key Value Eg. REG_DWORD, REG_SZ, REG_BINARY, However Every Time It Will Enter The Data As REG_SZ.
--
Michael Allen
NURV | CyberCitizen

"If you spend more on coffee than on IT security, you will be hacked."
White House cybersecurity advisor, Richard Clarke
Last edited by CyberCitizen on Tue Mar 01, 2005 11:53 pm, edited 1 time in total.

armsys
Automation Wizard
Posts: 1108
Joined: Wed Dec 04, 2002 10:28 am
Location: Hong Kong

Post by armsys » Mon Feb 28, 2005 2:01 am

Hi CyberCitizen,

In accordance with the online help, it can't. For security reason, I can see you need the extended support of data types.

User avatar
support
Automation Wizard
Posts: 1450
Joined: Sat Oct 19, 2002 4:38 pm
Location: London
Contact:

Post by support » Mon Feb 28, 2005 9:06 am

You can do it with VBScript. Here's an example:

VBSTART
Sub RegExample
Dim WSHShell
Set WSHShell = CreateObject("WScript.Shell")

WSHShell.Popup "Create key HKCU\MyRegKey with value 'Top level key'"
WSHShell.RegWrite "HKCU\MyRegKey\", "Top level key"

WSHShell.Popup "Create key HKCU\MyRegKey\Entry with value 'Second level key'"
WSHShell.RegWrite "HKCU\MyRegKey\Entry\", "Second level key"

WSHShell.Popup "Set value HKCU\MyRegKey\Value to REG_SZ 1"
WSHShell.RegWrite "HKCU\MyRegKey\Value", 1

WSHShell.Popup "Set value HKCU\MyRegKey\Entry to REG_DWORD 2"
WSHShell.RegWrite "HKCU\MyRegKey\Entry", 2, "REG_DWORD"

WSHShell.Popup "Set value HKCU\MyRegKey\Entry\Value1 to REG_BINARY 3"
WSHShell.RegWrite "HKCU\MyRegKey\Entry\Value1", 3, "REG_BINARY"

WSHShell.Popup "Delete value HKCU\MyRegKey\Entry\Value1"
WSHShell.RegDelete "HKCU\MyRegKey\Entry\Value1"

WSHShell.Popup "Delete key HKCU\MyRegKey\Entry"
WSHShell.RegDelete "HKCU\MyRegKey\Entry\"

WSHShell.Popup "Delete key HKCU\MyRegKey"
WSHShell.RegDelete "HKCU\MyRegKey\"
End Sub
VBEND

VBRun>RegExample
MJT Net Support
[email protected]

User avatar
CyberCitizen
Automation Wizard
Posts: 724
Joined: Sun Jun 20, 2004 7:06 am
Location: Adelaide, South Australia

Post by CyberCitizen » Tue Mar 01, 2005 11:54 pm

Ok I Will Play Around With It. My VB Is Not Very Good So I Will Have A Try & Let You Know How I Go.
--
Michael Allen
NURV | CyberCitizen

"If you spend more on coffee than on IT security, you will be hacked."
White House cybersecurity advisor, Richard Clarke

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts