Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > VB Script

Vista - UnjoinDomainOrWorkgroup Windows 2000

Reply
 
Old 02-18-2009   #1 (permalink)
DMc2007


 
 

UnjoinDomainOrWorkgroup Windows 2000

Hi

Does the Win32_ComputerSystem method UnjoinDomainOrWorkgroup support Windows
2000 Clients, as I am getting am error on the following:

Const NETSETUP_ACCT_DELETE = 2 'Disables computer account in domain.
strPassword = "SW2009Feb10792-d"
strUser = "SWCAMW"

Dim intreturn
Set objNetwork = CreateObject("WScript.Network")
strComputer = objNetwork.ComputerName

Set objComputer = GetObject("winmgmts:{impersonationLevel=Impersonate}!\\"
& _
strComputer & "\root\cimv2:Win32_ComputerSystem.Name='" & strComputer &
"'")
strDomain = objComputer.Domain
intReturn = objComputer.UnjoinDomainOrWorkgroup _
(strPassword, strDomain & "\" & strUser, NETSETUP_ACCT_DELETE)

Basically i am trying to remove a Windows 2000 Workstation from a Domain.

Regards

D



My System SpecsSystem Spec
Old 02-18-2009   #2 (permalink)
Paul Bergson [MVP-DS]


 
 

Re: UnjoinDomainOrWorkgroup Windows 2000

Here is a script repository example using and LDAP call, you will just have
to know the Distinguished Name (DN)
http://www.microsoft.com/technet/scr....mspx?mfr=true

--
Paul Bergson
MVP - Directory Services
MCTS, MCT, MCSE, MCSA, Security+, BS CSci
2008, 2003, 2000 (Early Achiever), NT4

http://www.pbbergs.com

Please no e-mails, any questions should be posted in the NewsGroup This
posting is provided "AS IS" with no warranties, and confers no rights.


"DMc2007" <davidmcnaughton_1999@xxxxxx> wrote in message
news:OaEyrsbkJHA.1184@xxxxxx
Quote:

> Hi
>
> Does the Win32_ComputerSystem method UnjoinDomainOrWorkgroup support
> Windows 2000 Clients, as I am getting am error on the following:
>
> Const NETSETUP_ACCT_DELETE = 2 'Disables computer account in domain.
> strPassword = "SW2009Feb10792-d"
> strUser = "SWCAMW"
>
> Dim intreturn
> Set objNetwork = CreateObject("WScript.Network")
> strComputer = objNetwork.ComputerName
>
> Set objComputer =
> GetObject("winmgmts:{impersonationLevel=Impersonate}!\\" & _
> strComputer & "\root\cimv2:Win32_ComputerSystem.Name='" & strComputer &
> "'")
> strDomain = objComputer.Domain
> intReturn = objComputer.UnjoinDomainOrWorkgroup _
> (strPassword, strDomain & "\" & strUser, NETSETUP_ACCT_DELETE)
>
> Basically i am trying to remove a Windows 2000 Workstation from a Domain.
>
> Regards
>
> D
>
My System SpecsSystem Spec
Old 02-18-2009   #3 (permalink)
Richard Mueller [MVP]


 
 

Re: UnjoinDomainOrWorkgroup Windows 2000


"DMc2007" <davidmcnaughton_1999@xxxxxx> wrote in message
news:OaEyrsbkJHA.1184@xxxxxx
Quote:

> Hi
>
> Does the Win32_ComputerSystem method UnjoinDomainOrWorkgroup support
> Windows 2000 Clients, as I am getting am error on the following:
>
> Const NETSETUP_ACCT_DELETE = 2 'Disables computer account in domain.
> strPassword = "SW2009Feb10792-d"
> strUser = "SWCAMW"
>
> Dim intreturn
> Set objNetwork = CreateObject("WScript.Network")
> strComputer = objNetwork.ComputerName
>
> Set objComputer =
> GetObject("winmgmts:{impersonationLevel=Impersonate}!\\" & _
> strComputer & "\root\cimv2:Win32_ComputerSystem.Name='" & strComputer &
> "'")
> strDomain = objComputer.Domain
> intReturn = objComputer.UnjoinDomainOrWorkgroup _
> (strPassword, strDomain & "\" & strUser, NETSETUP_ACCT_DELETE)
>
> Basically i am trying to remove a Windows 2000 Workstation from a Domain.
>
> Regards
>
> D
Per this link it should work on Windows 2000 clients:

http://www.microsoft.com/technet/scr.../cptrvb19.mspx

If you get an error, what is the error message and on which line is it
raised?

--
Richard Mueller
MVP Directory Services
Hilltop Lab - http://www.rlmueller.net
--


My System SpecsSystem Spec
Old 02-18-2009   #4 (permalink)
DMc2007


 
 

Re: UnjoinDomainOrWorkgroup Windows 2000

Hi, the link opens the window with the main script catergorys?

Regards

D
"Paul Bergson [MVP-DS]" <pbbergs@xxxxxx_msn.com> wrote in message
news:7B88F29B-310F-4CCB-BBD4-2ADAABB6966F@xxxxxx
Quote:

> Here is a script repository example using and LDAP call, you will just
> have to know the Distinguished Name (DN)
> http://www.microsoft.com/technet/scr....mspx?mfr=true
>
> --
> Paul Bergson
> MVP - Directory Services
> MCTS, MCT, MCSE, MCSA, Security+, BS CSci
> 2008, 2003, 2000 (Early Achiever), NT4
>
> http://www.pbbergs.com
>
> Please no e-mails, any questions should be posted in the NewsGroup This
> posting is provided "AS IS" with no warranties, and confers no rights.
>
>
> "DMc2007" <davidmcnaughton_1999@xxxxxx> wrote in message
> news:OaEyrsbkJHA.1184@xxxxxx
Quote:

>> Hi
>>
>> Does the Win32_ComputerSystem method UnjoinDomainOrWorkgroup support
>> Windows 2000 Clients, as I am getting am error on the following:
>>
>> Const NETSETUP_ACCT_DELETE = 2 'Disables computer account in domain.
>> strPassword = "SW2009Feb10792-d"
>> strUser = "SWCAMW"
>>
>> Dim intreturn
>> Set objNetwork = CreateObject("WScript.Network")
>> strComputer = objNetwork.ComputerName
>>
>> Set objComputer =
>> GetObject("winmgmts:{impersonationLevel=Impersonate}!\\" & _
>> strComputer & "\root\cimv2:Win32_ComputerSystem.Name='" & strComputer &
>> "'")
>> strDomain = objComputer.Domain
>> intReturn = objComputer.UnjoinDomainOrWorkgroup _
>> (strPassword, strDomain & "\" & strUser, NETSETUP_ACCT_DELETE)
>>
>> Basically i am trying to remove a Windows 2000 Workstation from a Domain.
>>
>> Regards
>>
>> D
>>
>

My System SpecsSystem Spec
Old 02-18-2009   #5 (permalink)
DMc2007


 
 

Re: UnjoinDomainOrWorkgroup Windows 2000

Using on a Windows 2000 SP4 Domain workstation, on a Windows 2003 Domain.

Code is below:

Const NETSETUP_ACCT_DELETE = 2 'Disables computer account in domain.
strPassword = "SW2009Feb10792-d"
strUser = "SWCAMW"

Set objNetwork = CreateObject("WScript.Network")
strComputer = objNetwork.ComputerName

Set objComputer = GetObject("winmgmts:{impersonationLevel=Impersonate}!\\" &
_
strComputer & "\root\cimv2:Win32_ComputerSystem.Name='" & strComputer &
"'")
strDomain = objComputer.Domain
intReturn = objComputer.UnjoinDomainOrWorkgroup _
(strPassword, strDomain & "\" & strUser, NETSETUP_ACCT_DELETE)

Error message is as follows:

Script: C:\Temp\DeleteFromDomain.vbs
Line: 11
Char: 1
Error: Object doesn't support this property or method:
'objComputer.UnjoinDomainOrWorkGroup'
Code: 800A01B6
Source: Microsoft VBScript runtime error.

Kind Regards

D


"Richard Mueller [MVP]" <rlmueller-nospam@xxxxxx> wrote in
message news:e65wADekJHA.5836@xxxxxx
Quote:

>
> "DMc2007" <davidmcnaughton_1999@xxxxxx> wrote in message
> news:OaEyrsbkJHA.1184@xxxxxx
Quote:

>> Hi
>>
>> Does the Win32_ComputerSystem method UnjoinDomainOrWorkgroup support
>> Windows 2000 Clients, as I am getting am error on the following:
>>
>> Const NETSETUP_ACCT_DELETE = 2 'Disables computer account in domain.
>> strPassword = "SW2009Feb10792-d"
>> strUser = "SWCAMW"
>>
>> Dim intreturn
>> Set objNetwork = CreateObject("WScript.Network")
>> strComputer = objNetwork.ComputerName
>>
>> Set objComputer =
>> GetObject("winmgmts:{impersonationLevel=Impersonate}!\\" & _
>> strComputer & "\root\cimv2:Win32_ComputerSystem.Name='" & strComputer &
>> "'")
>> strDomain = objComputer.Domain
>> intReturn = objComputer.UnjoinDomainOrWorkgroup _
>> (strPassword, strDomain & "\" & strUser, NETSETUP_ACCT_DELETE)
>>
>> Basically i am trying to remove a Windows 2000 Workstation from a Domain.
>>
>> Regards
>>
>> D
>
> Per this link it should work on Windows 2000 clients:
>
> http://www.microsoft.com/technet/scr.../cptrvb19.mspx
>
> If you get an error, what is the error message and on which line is it
> raised?
>
> --
> Richard Mueller
> MVP Directory Services
> Hilltop Lab - http://www.rlmueller.net
> --
>
>

My System SpecsSystem Spec
Old 02-18-2009   #6 (permalink)
Richard Mueller [MVP]


 
 

Re: UnjoinDomainOrWorkgroup Windows 2000

I've never used the UnjoinDomainOrWorkgroup method, but I just looked at my
script that uses the JoinDomainOrWorkgroup method. I have this comment based
on research I did some time ago:

' The computer must have XP or above.
' The AD must be W2k3 or above.
' See c:\Windows\debug\NetSetup.log for details.

I would say the link I gave is incorrect. The client must be XP or above
(unless someone knows how to upgrade WMI to support the method).

--
Richard Mueller
MVP Directory Services
Hilltop Lab - http://www.rlmueller.net
--

"DMc2007" <davidmcnaughton_1999@xxxxxx> wrote in message
news:u2eW%23TekJHA.6124@xxxxxx
Quote:

> Using on a Windows 2000 SP4 Domain workstation, on a Windows 2003 Domain.
>
> Code is below:
>
> Const NETSETUP_ACCT_DELETE = 2 'Disables computer account in domain.
> strPassword = "SW2009Feb10792-d"
> strUser = "SWCAMW"
>
> Set objNetwork = CreateObject("WScript.Network")
> strComputer = objNetwork.ComputerName
>
> Set objComputer = GetObject("winmgmts:{impersonationLevel=Impersonate}!\\"
> & _
> strComputer & "\root\cimv2:Win32_ComputerSystem.Name='" & strComputer &
> "'")
> strDomain = objComputer.Domain
> intReturn = objComputer.UnjoinDomainOrWorkgroup _
> (strPassword, strDomain & "\" & strUser, NETSETUP_ACCT_DELETE)
>
> Error message is as follows:
>
> Script: C:\Temp\DeleteFromDomain.vbs
> Line: 11
> Char: 1
> Error: Object doesn't support this property or method:
> 'objComputer.UnjoinDomainOrWorkGroup'
> Code: 800A01B6
> Source: Microsoft VBScript runtime error.
>
> Kind Regards
>
> D
>
>
> "Richard Mueller [MVP]" <rlmueller-nospam@xxxxxx> wrote in
> message news:e65wADekJHA.5836@xxxxxx
Quote:

>>
>> "DMc2007" <davidmcnaughton_1999@xxxxxx> wrote in message
>> news:OaEyrsbkJHA.1184@xxxxxx
Quote:

>>> Hi
>>>
>>> Does the Win32_ComputerSystem method UnjoinDomainOrWorkgroup support
>>> Windows 2000 Clients, as I am getting am error on the following:
>>>
>>> Const NETSETUP_ACCT_DELETE = 2 'Disables computer account in domain.
>>> strPassword = "SW2009Feb10792-d"
>>> strUser = "SWCAMW"
>>>
>>> Dim intreturn
>>> Set objNetwork = CreateObject("WScript.Network")
>>> strComputer = objNetwork.ComputerName
>>>
>>> Set objComputer =
>>> GetObject("winmgmts:{impersonationLevel=Impersonate}!\\" & _
>>> strComputer & "\root\cimv2:Win32_ComputerSystem.Name='" & strComputer
>>> & "'")
>>> strDomain = objComputer.Domain
>>> intReturn = objComputer.UnjoinDomainOrWorkgroup _
>>> (strPassword, strDomain & "\" & strUser, NETSETUP_ACCT_DELETE)
>>>
>>> Basically i am trying to remove a Windows 2000 Workstation from a
>>> Domain.
>>>
>>> Regards
>>>
>>> D
>>
>> Per this link it should work on Windows 2000 clients:
>>
>> http://www.microsoft.com/technet/scr.../cptrvb19.mspx
>>
>> If you get an error, what is the error message and on which line is it
>> raised?
>>
>> --
>> Richard Mueller
>> MVP Directory Services
>> Hilltop Lab - http://www.rlmueller.net
>> --
>>
>>
>
>

My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
Vista to 2000, 2000 has shared folder Vista networking & sharing
Install Windows 2000 on Windows Vista Home OEM machine multi boot Vista installation & setup
Problemas con Windows Vista Business SP1 en un dominio Windows Server 2000 Vista security
Windows vista, suported joing in domain Windows server 2000??? Vista networking & sharing
from windows 2000 to vista basic if prob with 2000? Vista General


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46