Page 1 of 1 1
Topic Options
#176582 - 07/05/30 11:18 AM ad value in the registry REG_MULTI_SZ
nlinbonn Offline
Fresh Scripter

Registered: 07/05/30
Posts: 6
Hello,
i have to ad a value in the regestry(hardware "MSN-Number")and if i do it right it has to look like this (if i export the key)
"IsdnMultiSubscriberNumbers"=hex(7):35,00,33,00,33,00,00,00,00,00

i try this:
WRITEVALUE( "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Class\{4D36E972-E325-11CE-BFC1-08002BE10318}\0006\0" , "IsdnMultiSubscriberNumbers", "533" , "REG_MULTI_SZ")


but it does not work correctly.

can someone help me?
thanks a lot


Attachments
38-howtochancereg.zip (294 downloads)
Description:



Top
#176583 - 07/05/30 11:20 AM Re: ad value in the registry REG_MULTI_SZ [Re: nlinbonn]
roedie Offline
Getting the hang of it

Registered: 05/11/15
Posts: 52
Loc: balk friesland/holland
this worked for me:

WriteValue("HKEY_CURRENT_USER\Software\Microsoft\Office\9.0\Outlook\Security\","name","value","REG_MULTI_SZ")

Top
#176584 - 07/05/30 01:09 PM Re: ad value in the registry REG_MULTI_SZ [Re: roedie]
nlinbonn Offline
Fresh Scripter

Registered: 07/05/30
Posts: 6
yes thats works for me to.
but i need te "value".
it has to be in hex and the first seven characters gives the msn-number and after the eicht character has to be in hex to " 00 00.

it looks like this after:
0000 35 00 33 34 00 00 00 5.3.4...
0008 00 00 ..

but thank you

Top
#176585 - 07/05/30 01:33 PM Re: ad value in the registry REG_MULTI_SZ [Re: nlinbonn]
Arend_ Moderator Offline
MM club member
*****

Registered: 05/01/17
Posts: 1815
Loc: Hilversum, The Netherlands
The exported hex values you have to put together sequentially for instance 00 3E F4 becomes 003EF4. Assign that to a variable and write to the registry like the code below.

 Code:
$hexvalue = "001122335543352545432542"
$=WriteValue('HKLM\SYSTEM\CurrentControlSet\Control\Class\{4D36E972-E325-11CE-BFC1-08002BE10318}\0006\0', 'IsdnMultiSubscriberNumbers',$hexvalue,'REG_MULTI_SZ')

Top
#176590 - 07/05/30 02:58 PM Re: ad value in the registry REG_MULTI_SZ [Re: Arend_]
Les Offline
KiX Master
*****

Registered: 01/06/11
Posts: 12734
Loc: fortfrances.on.ca
Multistring should be written with bar separators as per the example in the manual.
 Code:
$RC=WriteValue("EZReg\Test", "A MultiString variable", "Line 1|Line 2|Line 3 with a || in it|" "REG_MULTI_SZ")
If @ERROR = 0
  ? "Value written to the registry"
Endif 
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#176598 - 07/05/30 05:10 PM Re: ad value in the registry REG_MULTI_SZ [Re: Les]
nlinbonn Offline
Fresh Scripter

Registered: 07/05/30
Posts: 6
thanks i will try it tomorrow wenn i start working
Top
#176599 - 07/05/30 05:16 PM Re: ad value in the registry REG_MULTI_SZ [Re: Les]
Arend_ Moderator Offline
MM club member
*****

Registered: 05/01/17
Posts: 1815
Loc: Hilversum, The Netherlands
I agree, but it isn't multistring, it's a hex value \:\)
Top
#176604 - 07/05/30 08:39 PM Re: ad value in the registry REG_MULTI_SZ [Re: Arend_]
NTDOC Administrator Offline
Administrator
*****

Registered: 00/07/28
Posts: 11545
Loc: CA
It might be and he just didn't realize it or show it. It also might want/need a separator tacked onto the end otherwise not really sure why it would need to be multi
Top
#176618 - 07/05/31 10:39 AM Re: ad value in the registry REG_MULTI_SZ [Re: NTDOC]
nlinbonn Offline
Fresh Scripter

Registered: 07/05/30
Posts: 6
IT Works \:\) !! Thanks
i used
$Result = "532|"
$ReturnCode = WRITEVALUE( "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Class\{4D36E972-E325-11CE-BFC1-08002BE10318}\0006\0" , "IsdnMultiSubscriberNumbers", $Result , "REG_MULTI_SZ")

and now its exactly what i was looking for.

Thanks a lot !!

i have to chance it on many computer
i hope the classes ({4D36E972-E325-11CE-BFC1-08002BE10318})are all the same.
if it isnt cann i go an other way to chance it?

thanks

Top
#176625 - 07/05/31 04:29 PM Re: ad value in the registry REG_MULTI_SZ [Re: nlinbonn]
nlinbonn Offline
Fresh Scripter

Registered: 07/05/30
Posts: 6
thanks.
it all works like i need it.

is it possible with kix to chance the computername and put im in the domaine (ADS) ?

Top
#176626 - 07/05/31 04:43 PM Re: ad value in the registry REG_MULTI_SZ [Re: nlinbonn]
Mart Moderator Offline
KiX Supporter
*****

Registered: 02/03/27
Posts: 4603
Loc: The Netherlands
 Originally Posted By: nlinbonn

....
is it possible with kix to chance the computername and put im in the domaine (ADS)?


Not with pure kix.
MS has a tool called netdom. You can use this in a kix script to rename a computer.

How To Use the Netdom.exe Utility to Rename a Computer in Windows XP
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.

Top
#176628 - 07/05/31 05:49 PM Re: ad value in the registry REG_MULTI_SZ [Re: Mart]
Arend_ Moderator Offline
MM club member
*****

Registered: 05/01/17
Posts: 1815
Loc: Hilversum, The Netherlands
Can with kix as well, quick untested code:
 Code:
;Rename a Computer
$objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2")
$colComputers = $objWMIService.ExecQuery("Select * from Win32_ComputerSystem")
For Each $objComputer in $colComputers
  $=$objComputer.Rename("computernameXP1")
Next

;Join a Computer to a Domain
$JOIN_DOMAIN = 1
$ACCT_CREATE = 2
$ACCT_DELETE = 4
$WIN9X_UPGRADE = 16
$DOMAIN_JOIN_IF_JOINED = 32
$JOIN_UNSECURE = 64
$MACHINE_PASSWORD_PASSED = 128
$DEFERRED_SPN_SET = 256
$INSTALL_INVOCATION = 262144

$objNetwork = CreateObject("WScript.Network")
$strComputer = $objNetwork.ComputerName
$strDomain = "domainname"
$strPassword = "Password"
$strUser = "username"

$objComputer = GetObject("winmgmts:{impersonationLevel=Impersonate}!\\" + $strComputer + "\root\cimv2:Win32_ComputerSystem.Name='" + $strComputer + "'")
$ReturnValue = $objComputer.JoinDomainOrWorkGroup($strDomain,$strPassword,$strDomain + "\" + $strUser,,$JOIN_DOMAIN + $ACCT_CREATE)

Top
#176639 - 07/05/31 08:30 PM Re: ad value in the registry REG_MULTI_SZ [Re: Arend_]
Mart Moderator Offline
KiX Supporter
*****

Registered: 02/03/27
Posts: 4603
Loc: The Netherlands
One could argue if your code is pure kix because it uses WMI and the Windows scripting host but at least it requires no external tools as my option does.

Just yanking your chain Arend no harm intended. You're e a great scripter

I'm always in for a solution that eliminates the use of external apps and therefore has les dependencies. It relies on WMI and Windows scripting host being present but those are both installed by default on every recent system.
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.

Top
#176662 - 07/06/01 12:34 AM Re: ad value in the registry REG_MULTI_SZ [Re: Mart]
NTDOC Administrator Offline
Administrator
*****

Registered: 00/07/28
Posts: 11545
Loc: CA
Yes there are more issues and concerns to be aware of when using KiX to do it. Shelling to NETDOM though is easier, but ADSI code should be all you need to do it. Though as I recall no one has posted a 100% working UDF type solution for it since using NETDOM is rather easy.

Here is a very old post I made with a KiXforms script. I'm sure it could use some code update but you can view it here if wanted.

JoinAD
http://www.kixtart.org/forums/ubbthreads.php?ubb=showflat&Board=2&Number=75216



.

Top
#176664 - 07/06/01 09:49 AM Re: ad value in the registry REG_MULTI_SZ [Re: Mart]
Arend_ Moderator Offline
MM club member
*****

Registered: 05/01/17
Posts: 1815
Loc: Hilversum, The Netherlands
Haha thx mart \:\)

Here is code that uses ADSI to create a comp account.
Just coded and tested.
 Code:
Dim $compname, $ldap, $comp
$compname = "TestPC2" ; can also use @WKSTA
$ldap = GetObject("LDAP://OU=SomeSubOU,OU=SomeOU,DC=SomeDomain,DC=SomeDomainExtention")
$comp = $ldap.Create("Computer","CN=" + $compname)
$comp.Put("samAccountName", $compname + "$")
$comp.Put("userAccountControl", 4096)
$comp.SetInfo

Top
#176667 - 07/06/01 11:02 AM Re: ad value in the registry REG_MULTI_SZ [Re: Arend_]
Arend_ Moderator Offline
MM club member
*****

Registered: 05/01/17
Posts: 1815
Loc: Hilversum, The Netherlands
Made a new post in COM Scripting ADSI Computer Account Essentials
Top
#176679 - 07/06/01 02:17 PM Re: ad value in the registry REG_MULTI_SZ [Re: Arend_]
nlinbonn Offline
Fresh Scripter

Registered: 07/05/30
Posts: 6
ok now i can create a account and move them in the ADS
but what do i need to chance an existing computername in the ads?


apronk,thanks but i dont understand your skript ;Join a Computer to a Domain

im not a scriptwriter \:\(

Top
#176681 - 07/06/01 04:31 PM Re: ad value in the registry REG_MULTI_SZ [Re: nlinbonn]
Arend_ Moderator Offline
MM club member
*****

Registered: 05/01/17
Posts: 1815
Loc: Hilversum, The Netherlands
Here, I even verified my own code for a change ;\)
Change "NewPCName" to the new computername u want \:\)

Make sure you reboot to make the change go in effect after runinng this script. This will assume you have Network admin privilidges or at least Account Operator privilidges. It will error out if there are none.

 Code:
$objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2")
$x = $objWMIService.InstancesOf("Win32_ComputerSystem").Item("Win32_ComputerSystem='"+@WKSTA+"'").Rename("NewPCName")
If $x <> 0
  ? @SERROR
  Exit @ERROR
EndIf

Top
#176692 - 07/06/01 11:45 PM Re: ad value in the registry REG_MULTI_SZ [Re: Arend_]
NTDOC Administrator Offline
Administrator
*****

Registered: 00/07/28
Posts: 11545
Loc: CA
Thanks for doing the lookup and code writing I'll have to do a KF update to JoinAD sometime.
Top
Page 1 of 1 1


Moderator:  Jochen, Allen, Radimus, Chris S., Glenn Barnas, ShaneEP, Arend_, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 113 anonymous users online.
Newest Members
schnuggel, h315060, johnnyutah, pmk31, ArserHsieh
17412 Registered Users

Generated in 0.042 seconds in which 0.01 seconds were spent on a total of 14 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org