I have looked at 2 options, netdom and wmi rename but what is the best
way to rename a computer and account from a script ? Also looked at
rename and then adding computer to a doamin which depends on the
circumstance may not be appropriate. I need to connect to a global
catolgue while doing this so changes are seen immediately.

The rename occurs most time from the workstation that is already a
member of the domain. Administrator rights may need to be provided.

I've been having issues with passing the variable computername into the
wmi rename option.

Any ideas or thoughts on better ways or the best way to do this ?

Cheers,

Re: rename computer by Alex

Alex
Wed Apr 23 07:18:44 CDT 2008

Could you post the code you're using at this point? It will probably
demonstrate the problem you're encountering with performing the rename in
WMI.

"sputnik" <sputnik@gmail.com> wrote in message
news:O7MkmIIpIHA.6096@TK2MSFTNGP06.phx.gbl...
> I have looked at 2 options, netdom and wmi rename but what is the best way
> to rename a computer and account from a script ? Also looked at rename
> and then adding computer to a doamin which depends on the circumstance may
> not be appropriate. I need to connect to a global catolgue while doing
> this so changes are seen immediately.
>
> The rename occurs most time from the workstation that is already a member
> of the domain. Administrator rights may need to be provided.
>
> I've been having issues with passing the variable computername into the
> wmi rename option.
>
> Any ideas or thoughts on better ways or the best way to do this ?
>
> Cheers,
>
>

Re: rename computer by Jim

Jim
Wed Apr 23 07:56:30 CDT 2008


Try this...

Use PSEXEC from MSFT to perform this remotely. You can modify this by
using the WMI Code Creator. Google for it.

----------------------------------------------------------------------------=
----------------------------------------------------------------------------=
-------
strComputer =3D "."
Set objWMIService =3D GetObject("winmgmts:\\" & strComputer & "\root
\CIMV2")
' Obtain an instance of the the class
' using a key property value.
Set objShare =3D
objWMIService.Get("Win32_ComputerSystem.ReplaceKeyProperty=3DReplaceProperty=
Value")

' Obtain an InParameters object specific
' to the method.
Set objInParam =3D objShare.Methods_("Rename"). _
inParameters.SpawnInstance_()


' Add the input parameters.
objInParam.Properties_.Item("Name") =3D "newcomputername"
objInParam.Properties_.Item("Password") =3D "password"
objInParam.Properties_.Item("UserName") =3D "username"

' Execute the method and obtain the return status.
' The OutParameters object in objOutParams
' is created by the provider.
Set objOutParams =3D
objWMIService.ExecMethod("Win32_ComputerSystem.ReplaceKeyProperty=3DReplaceP=
ropertyValue",
"Rename", objInParam)

' List OutParams
Wscript.Echo "Out Parameters: "
Wscript.echo "ReturnValue: " & objOutParams.ReturnValue

----------------------------------------------------------------------------=
------------------------------------------------------------------

On Apr 22, 9:07=A0am, sputnik <sput...@gmail.com> wrote:
> I have looked at 2 options, netdom and wmi rename but what is the best
> way to rename a computer and account from a script ? =A0Also looked at
> rename and then adding computer to a doamin which depends on the
> circumstance may not be appropriate. =A0I need to connect to a global
> catolgue while doing this so changes are seen immediately.
>
> The rename occurs most time from the workstation that is already a
> member of the domain. =A0Administrator rights may need to be provided.
>
> I've been having issues with passing the variable computername into the
> wmi rename option.
>
> Any ideas or thoughts on better ways or the best way to do this ?
>
> Cheers,