Overclock.net › Forums › Software, Programming and Coding › Coding and Programming › script to remove a computer from a domain and then another to re add it
New Posts  All Forums:Forum Nav:

script to remove a computer from a domain and then another to re add it

post #1 of 5
Thread Starter 
I'm looking for a way to script the process of removing a local computer from a domain. normally i do it manually but id like to get a batch script that can do it automatically.

then if i can get that don id like to find a way to get a batch script to add a computer to a domain. but before it is added i'd like to be able to define the computer name and computer description.

if anyone knows how to do this please let me know as ive been looking all over the web and i cant find it.

I want this to be done on the client machine not the domain controller, as ive just re imaged and i'm rejoining them now.
Edited by Tempest_Inc - 7/22/11 at 2:33pm
 
MacBook Pro 6.1
(16 items)
 
Server
(19 items)
 
CPUMotherboardGraphicsRAM
Core i7 Q720 Asus ATI Mobility Radeon HD 5870 1GB DDR5 12 GB DDR3 
Hard DriveOSMonitorKeyboard
Seagate Momentus XT 500GB 7200RPM & Seagate 750... Windows 7 Ultimate x64 17.3" LED LCD Factory 
PowerCaseMouseMouse Pad
Factory Factory Logitech G9X Mine 
CPUMotherboardGraphicsGraphics
Intel Core i5 MacBook Pro 6.1 17" Intel HD Graphics NVIDIA GeForce GT 330M 
RAMHard DriveOptical DriveCooling
4 GB DDR3 1067 MHz Hitachi HTS545050B9SA02 HL-DT-ST DVDRW GS23N Factory 
OSMonitorKeyboardPower
Mac OS X 10.6.8 17" LED Factory Factory 
CaseMouseMouse PadAudio
Factory Factory None Factory 
CPUMotherboardGraphicsRAM
Intel Core 2 Quad Q9550 Abit IP35 Pro PNY VCQ290NVS-PCIEX16-PB Quadro NVS 290 256MB 64-b G.Skill F2-8000CL5D-4GBPQ 
Hard DriveHard DriveHard DriveHard Drive
Dell Perc5/i Samsung HD204UI Seagate Constellation ES SAS Drive Model: ST310... Hitachi Deskstar 
Hard DriveHard DriveOptical DriveCooling
Western Digital WD1002FAEX Black Western Digital Black 2 x ASUS DRW-2014L1T Corsair H50 
OSMonitorKeyboardPower
Windows Server 2008 R2 Standard x64 ASUS VK222U Black 22" 2ms Logitech G15 (Original) - U.S. Dvorak Layout Enermax INFINITI EIN720AWT 720w 
CaseMouseMouse Pad
LIAN LI V SERIES PC-V2100A Silver Aluminum ATX ... Logitech G9x Steven's Computer Service 
  hide details  
Reply
 
MacBook Pro 6.1
(16 items)
 
Server
(19 items)
 
CPUMotherboardGraphicsRAM
Core i7 Q720 Asus ATI Mobility Radeon HD 5870 1GB DDR5 12 GB DDR3 
Hard DriveOSMonitorKeyboard
Seagate Momentus XT 500GB 7200RPM & Seagate 750... Windows 7 Ultimate x64 17.3" LED LCD Factory 
PowerCaseMouseMouse Pad
Factory Factory Logitech G9X Mine 
CPUMotherboardGraphicsGraphics
Intel Core i5 MacBook Pro 6.1 17" Intel HD Graphics NVIDIA GeForce GT 330M 
RAMHard DriveOptical DriveCooling
4 GB DDR3 1067 MHz Hitachi HTS545050B9SA02 HL-DT-ST DVDRW GS23N Factory 
OSMonitorKeyboardPower
Mac OS X 10.6.8 17" LED Factory Factory 
CaseMouseMouse PadAudio
Factory Factory None Factory 
CPUMotherboardGraphicsRAM
Intel Core 2 Quad Q9550 Abit IP35 Pro PNY VCQ290NVS-PCIEX16-PB Quadro NVS 290 256MB 64-b G.Skill F2-8000CL5D-4GBPQ 
Hard DriveHard DriveHard DriveHard Drive
Dell Perc5/i Samsung HD204UI Seagate Constellation ES SAS Drive Model: ST310... Hitachi Deskstar 
Hard DriveHard DriveOptical DriveCooling
Western Digital WD1002FAEX Black Western Digital Black 2 x ASUS DRW-2014L1T Corsair H50 
OSMonitorKeyboardPower
Windows Server 2008 R2 Standard x64 ASUS VK222U Black 22" 2ms Logitech G15 (Original) - U.S. Dvorak Layout Enermax INFINITI EIN720AWT 720w 
CaseMouseMouse Pad
LIAN LI V SERIES PC-V2100A Silver Aluminum ATX ... Logitech G9x Steven's Computer Service 
  hide details  
Reply
post #2 of 5
To Remove
Quote:
netdom.exe remove %computername% /domain:domainname /UserD:DomainName\UserName /PasswordD:Password

To add
Quote:
netdom.exe join %computername% /domain:DomainName /UserD:DomainName\UserName /PasswordD:Password

Edit: of course you will need to DL netdom from MS.
Gene-Z Dedi
(7 items)
 
Captain America
(6 items)
 
 
CPUMotherboardRAMHard Drive
i7 2600k @ 5.2 Ghz Asus Maximus IV Gene-Z Gskill 2133 4GB Caviar Black 
CoolingOSPower
Corsair H100 Arch x64 OCZ 650 Watt 
CPUCPUMotherboardGraphics
Intel Xeon E5-2650 Intel Xeon E5-2650 ASUS Z9PE-D8 WS XFX 6870 
RAMOS
32 GB Samsung Arch Nix 
  hide details  
Reply
Gene-Z Dedi
(7 items)
 
Captain America
(6 items)
 
 
CPUMotherboardRAMHard Drive
i7 2600k @ 5.2 Ghz Asus Maximus IV Gene-Z Gskill 2133 4GB Caviar Black 
CoolingOSPower
Corsair H100 Arch x64 OCZ 650 Watt 
CPUCPUMotherboardGraphics
Intel Xeon E5-2650 Intel Xeon E5-2650 ASUS Z9PE-D8 WS XFX 6870 
RAMOS
32 GB Samsung Arch Nix 
  hide details  
Reply
post #3 of 5
Thread Starter 
Quote:
Originally Posted by JedixJarf;14308402 
To Remove



To add



Edit: of course you will need to DL netdom from MS.



now is this from the workstation its self? because that where i need to be doing this from as im removing it and re-adding it to the domain after re-imaging the computer and im tired of doing it manually.
 
MacBook Pro 6.1
(16 items)
 
Server
(19 items)
 
CPUMotherboardGraphicsRAM
Core i7 Q720 Asus ATI Mobility Radeon HD 5870 1GB DDR5 12 GB DDR3 
Hard DriveOSMonitorKeyboard
Seagate Momentus XT 500GB 7200RPM & Seagate 750... Windows 7 Ultimate x64 17.3" LED LCD Factory 
PowerCaseMouseMouse Pad
Factory Factory Logitech G9X Mine 
CPUMotherboardGraphicsGraphics
Intel Core i5 MacBook Pro 6.1 17" Intel HD Graphics NVIDIA GeForce GT 330M 
RAMHard DriveOptical DriveCooling
4 GB DDR3 1067 MHz Hitachi HTS545050B9SA02 HL-DT-ST DVDRW GS23N Factory 
OSMonitorKeyboardPower
Mac OS X 10.6.8 17" LED Factory Factory 
CaseMouseMouse PadAudio
Factory Factory None Factory 
CPUMotherboardGraphicsRAM
Intel Core 2 Quad Q9550 Abit IP35 Pro PNY VCQ290NVS-PCIEX16-PB Quadro NVS 290 256MB 64-b G.Skill F2-8000CL5D-4GBPQ 
Hard DriveHard DriveHard DriveHard Drive
Dell Perc5/i Samsung HD204UI Seagate Constellation ES SAS Drive Model: ST310... Hitachi Deskstar 
Hard DriveHard DriveOptical DriveCooling
Western Digital WD1002FAEX Black Western Digital Black 2 x ASUS DRW-2014L1T Corsair H50 
OSMonitorKeyboardPower
Windows Server 2008 R2 Standard x64 ASUS VK222U Black 22" 2ms Logitech G15 (Original) - U.S. Dvorak Layout Enermax INFINITI EIN720AWT 720w 
CaseMouseMouse Pad
LIAN LI V SERIES PC-V2100A Silver Aluminum ATX ... Logitech G9x Steven's Computer Service 
  hide details  
Reply
 
MacBook Pro 6.1
(16 items)
 
Server
(19 items)
 
CPUMotherboardGraphicsRAM
Core i7 Q720 Asus ATI Mobility Radeon HD 5870 1GB DDR5 12 GB DDR3 
Hard DriveOSMonitorKeyboard
Seagate Momentus XT 500GB 7200RPM & Seagate 750... Windows 7 Ultimate x64 17.3" LED LCD Factory 
PowerCaseMouseMouse Pad
Factory Factory Logitech G9X Mine 
CPUMotherboardGraphicsGraphics
Intel Core i5 MacBook Pro 6.1 17" Intel HD Graphics NVIDIA GeForce GT 330M 
RAMHard DriveOptical DriveCooling
4 GB DDR3 1067 MHz Hitachi HTS545050B9SA02 HL-DT-ST DVDRW GS23N Factory 
OSMonitorKeyboardPower
Mac OS X 10.6.8 17" LED Factory Factory 
CaseMouseMouse PadAudio
Factory Factory None Factory 
CPUMotherboardGraphicsRAM
Intel Core 2 Quad Q9550 Abit IP35 Pro PNY VCQ290NVS-PCIEX16-PB Quadro NVS 290 256MB 64-b G.Skill F2-8000CL5D-4GBPQ 
Hard DriveHard DriveHard DriveHard Drive
Dell Perc5/i Samsung HD204UI Seagate Constellation ES SAS Drive Model: ST310... Hitachi Deskstar 
Hard DriveHard DriveOptical DriveCooling
Western Digital WD1002FAEX Black Western Digital Black 2 x ASUS DRW-2014L1T Corsair H50 
OSMonitorKeyboardPower
Windows Server 2008 R2 Standard x64 ASUS VK222U Black 22" 2ms Logitech G15 (Original) - U.S. Dvorak Layout Enermax INFINITI EIN720AWT 720w 
CaseMouseMouse Pad
LIAN LI V SERIES PC-V2100A Silver Aluminum ATX ... Logitech G9x Steven's Computer Service 
  hide details  
Reply
post #4 of 5
Thread Starter 
bump
 
MacBook Pro 6.1
(16 items)
 
Server
(19 items)
 
CPUMotherboardGraphicsRAM
Core i7 Q720 Asus ATI Mobility Radeon HD 5870 1GB DDR5 12 GB DDR3 
Hard DriveOSMonitorKeyboard
Seagate Momentus XT 500GB 7200RPM & Seagate 750... Windows 7 Ultimate x64 17.3" LED LCD Factory 
PowerCaseMouseMouse Pad
Factory Factory Logitech G9X Mine 
CPUMotherboardGraphicsGraphics
Intel Core i5 MacBook Pro 6.1 17" Intel HD Graphics NVIDIA GeForce GT 330M 
RAMHard DriveOptical DriveCooling
4 GB DDR3 1067 MHz Hitachi HTS545050B9SA02 HL-DT-ST DVDRW GS23N Factory 
OSMonitorKeyboardPower
Mac OS X 10.6.8 17" LED Factory Factory 
CaseMouseMouse PadAudio
Factory Factory None Factory 
CPUMotherboardGraphicsRAM
Intel Core 2 Quad Q9550 Abit IP35 Pro PNY VCQ290NVS-PCIEX16-PB Quadro NVS 290 256MB 64-b G.Skill F2-8000CL5D-4GBPQ 
Hard DriveHard DriveHard DriveHard Drive
Dell Perc5/i Samsung HD204UI Seagate Constellation ES SAS Drive Model: ST310... Hitachi Deskstar 
Hard DriveHard DriveOptical DriveCooling
Western Digital WD1002FAEX Black Western Digital Black 2 x ASUS DRW-2014L1T Corsair H50 
OSMonitorKeyboardPower
Windows Server 2008 R2 Standard x64 ASUS VK222U Black 22" 2ms Logitech G15 (Original) - U.S. Dvorak Layout Enermax INFINITI EIN720AWT 720w 
CaseMouseMouse Pad
LIAN LI V SERIES PC-V2100A Silver Aluminum ATX ... Logitech G9x Steven's Computer Service 
  hide details  
Reply
 
MacBook Pro 6.1
(16 items)
 
Server
(19 items)
 
CPUMotherboardGraphicsRAM
Core i7 Q720 Asus ATI Mobility Radeon HD 5870 1GB DDR5 12 GB DDR3 
Hard DriveOSMonitorKeyboard
Seagate Momentus XT 500GB 7200RPM & Seagate 750... Windows 7 Ultimate x64 17.3" LED LCD Factory 
PowerCaseMouseMouse Pad
Factory Factory Logitech G9X Mine 
CPUMotherboardGraphicsGraphics
Intel Core i5 MacBook Pro 6.1 17" Intel HD Graphics NVIDIA GeForce GT 330M 
RAMHard DriveOptical DriveCooling
4 GB DDR3 1067 MHz Hitachi HTS545050B9SA02 HL-DT-ST DVDRW GS23N Factory 
OSMonitorKeyboardPower
Mac OS X 10.6.8 17" LED Factory Factory 
CaseMouseMouse PadAudio
Factory Factory None Factory 
CPUMotherboardGraphicsRAM
Intel Core 2 Quad Q9550 Abit IP35 Pro PNY VCQ290NVS-PCIEX16-PB Quadro NVS 290 256MB 64-b G.Skill F2-8000CL5D-4GBPQ 
Hard DriveHard DriveHard DriveHard Drive
Dell Perc5/i Samsung HD204UI Seagate Constellation ES SAS Drive Model: ST310... Hitachi Deskstar 
Hard DriveHard DriveOptical DriveCooling
Western Digital WD1002FAEX Black Western Digital Black 2 x ASUS DRW-2014L1T Corsair H50 
OSMonitorKeyboardPower
Windows Server 2008 R2 Standard x64 ASUS VK222U Black 22" 2ms Logitech G15 (Original) - U.S. Dvorak Layout Enermax INFINITI EIN720AWT 720w 
CaseMouseMouse Pad
LIAN LI V SERIES PC-V2100A Silver Aluminum ATX ... Logitech G9x Steven's Computer Service 
  hide details  
Reply
post #5 of 5
I don't have my work stuff here, but if you can wait until Monday, I can take a look at it and give you the script we use to add computers to a specific OU within AD. I don't think I have a removal script, though.
My Baby
(16 items)
 
  
CPUMotherboardGraphicsRAM
Core i5 2500k ASRock P67 Extreme4 XFX Radeon HD 6870 4 x 4 GB G.Skill Ripjaws DDR3 1600 
Hard DriveHard DriveOptical DriveCooling
Crucial C300  Samsung Spinpoint F3 Lite-On iHas124 DVD-R CM Hyper 212+ 
OSMonitorKeyboardPower
Windows 7 Home Prem. 64bit Asus VH238H Cooler Master Storm Trigger Corsair TX750V2 
CaseMouseMouse PadAudio
Cooler Master HAF 912 Logitech G500 XTrac Pads Ripper XXL Astro A30 Wireless 
  hide details  
Reply
My Baby
(16 items)
 
  
CPUMotherboardGraphicsRAM
Core i5 2500k ASRock P67 Extreme4 XFX Radeon HD 6870 4 x 4 GB G.Skill Ripjaws DDR3 1600 
Hard DriveHard DriveOptical DriveCooling
Crucial C300  Samsung Spinpoint F3 Lite-On iHas124 DVD-R CM Hyper 212+ 
OSMonitorKeyboardPower
Windows 7 Home Prem. 64bit Asus VH238H Cooler Master Storm Trigger Corsair TX750V2 
CaseMouseMouse PadAudio
Cooler Master HAF 912 Logitech G500 XTrac Pads Ripper XXL Astro A30 Wireless 
  hide details  
Reply
New Posts  All Forums:Forum Nav:
  Return Home
  Back to Forum: Coding and Programming
Overclock.net › Forums › Software, Programming and Coding › Coding and Programming › script to remove a computer from a domain and then another to re add it