Change Computername And Join Domain

Testing this stuff!

3.
It is also possible to specify user credentials within a script; this enables you to do such things as log on to a computer using a standard user account, yet still run a script that requires administrator privileges. For more information, go to http://msdn.microsoft.com/library/default.asp and search for “Creating a WMI Script.”

wbemImpersonationLevelImpersonate = 3
wbemAuthenticationLevelPktPrivacy = 6

Set objLocator = CreateObject("WbemScripting.SWbemLocator")
Set objService = objLocator.ConnectServer
("TargetComputer", "root\cimv2", "UserName", "Password")
objService.Security_.ImpersonationLevel = wbemImpersonationLevelImpersonate
objservices.Security_.AuthenticationLevel = wbemAuthenticationLevelPktPrivacy

http://www.tek-tips.com/viewthread.cfm?qid=1240726&page=1

or

http://cwashington.netreach.net/depo/view.asp?Index=877&ScriptType=vbscript

WMIC.exe is only available under Windows XP Professional, Windows Server 2003, Windows Vista and Windows Server "Longhorn".

wmic /node:"Computer Name (FQDN)" /USER:"username" RDTOGGLE WHERE ServerName="Computer Name" CALL SetAllowTSConnections 1

Rename and joindomainorworkgroup "api" only available on Windows XP. (not 2000)

Rename

wmic computersystem CALL joindomainorworkgroup name='NewNameOfWorkgroup' …

For example, we're often asked, "Why doesn't the Join Computer to a Domain script in TechNet's Script Center work on Windows 2000?" The answer is because the Win32_ComputerSystem class (which is the WMI class used in the script) doesn't support the JoinDomainOrWorkGroup method on Windows 2000. The JoinDomainOrWorkGroup method was added to the Win32_ComputerSystem class in the version of WMI built-in to Windows XP and Windows Server 2003.

source:
http://jamesfinnigan.spaces.live.com/blog/cns!9062539B2F0077D6!432.entry
http://www.dotnetframework.de/scripting/WMIReferenz.asp?C_Klasse=Win32_ComputerSystem
http://msdn2.microsoft.com/en-us/library/ms974592.aspx
http://msdn2.microsoft.com/en-us/library/aa394102(VS.85).aspx
http://en.wikipedia.org/wiki/Windows_Management_Instrumentation
http://www.microsoft.com/technet/scriptcenter/resources/wmifaq.mspx#E4DAC

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-Share Alike 2.5 License.