Stash... I have a question for you.

Bud Guy

Senior member
Nov 4, 1999
235
0
0
Sorry to single you out, but you seem to be on the ball with this stuff.

Once i've pulled a list of computers with:

dsquery computer -stalepwd 180

How do I take that list and then move the computers from one OU to another?

For example, I want to then move them from "OU=RSS computers, OU=RSS,DC=blahblahbl"

To: "OU=Unused computers, OU=RSS, DC=Blablabla"

Once they're in that OU, I'll manually disable them or delete them.

Thanks Again for all your help! I really do appreciate it.
 

stash

Diamond Member
Jun 22, 2000
5,468
0
0
Unfortunately, my scripting skills are pretty much non-existent. However, I would imagine you could take your dsquery command and loop through it with the dsmove command.

Is the list of old machines that large?
 

Bud Guy

Senior member
Nov 4, 1999
235
0
0
yeah, pretty large amount 1303.

I was hoping there was some way to chain dsquery with a dsmod or dsmove call.

Thanks anyways though! You're help has broght me a good ways with dsquery and dsget!
 

stash

Diamond Member
Jun 22, 2000
5,468
0
0
Well normally you can chain ds commands together with an OR (|), but I don't think it will work in this case, because it looks like dsmove will only take a single object as input. Which is why I suggested a loop.
 

gsellis

Diamond Member
Dec 4, 2003
6,061
0
0
You might find something at Clarence Washinton's Win32 Scripting site. A web search will find it.
 

dclive

Elite Member
Oct 23, 2003
5,626
2
81
Originally posted by: Bud Guy
Sorry to single you out, but you seem to be on the ball with this stuff.

Once i've pulled a list of computers with:

dsquery computer -stalepwd 180

How do I take that list and then move the computers from one OU to another?

For example, I want to then move them from "OU=RSS computers, OU=RSS,DC=blahblahbl"

To: "OU=Unused computers, OU=RSS, DC=Blablabla"

Once they're in that OU, I'll manually disable them or delete them.

Thanks Again for all your help! I really do appreciate it.


Now for another related question. Let's imagine you've got some laptops in the domain that never come into the office, and they establish a connection to the company's network after they've logged into XP using a cached login.

So, the steps are:

1. Laptop is built, joined to domain, user account is used to log into laptop
2. User takes laptop home
3. User logs into XP (cached login to domain account).
4. User establishes connection to company network from XP desktop (ie while looking at green-background XP desktop)
5. User's PC can browse the network normally, browse the internet, etc.

My understanding is that the computer shown above doesn't exchange passwords (machine account passwords) since it never actually logs into the domain (instead doing cached account logins).

If I run the script shown above, will it show the laptop computer accounts that are in active use *and* any computer accounts that are completely unused, or just the computer accounts that are completely unused?
 

Bud Guy

Senior member
Nov 4, 1999
235
0
0
Thanks for the replies!

How would you suggest I go about setting a loop up?

Thanks!
 

Woodie

Platinum Member
Mar 27, 2001
2,747
0
0
dsquery computer -stalepwd 180 | dsmove -newparent ou=DeadMachines,dc=microsoft,dc=com

That should do it...assuming you have the rights to issue the move commands. :)

BTW, dsmove /? | dsmovehelp.txt has most of this doc in it.

edit: NM...dsmove does not accept multiple inputs. :( You'll have to script it and feed it the machines one at a time.
 

Woodie

Platinum Member
Mar 27, 2001
2,747
0
0
Actually, stumbled onto this thread, and dsquery, etc... looks to be a very useful set of tools for my work. I had been writing direct LDAP queries in VBScript. While much more flexible, doing it that way is a lot more work. A combination of the two is likely to be very helpful for me.

And yes...it's an echo, as is the question. :)

To the OP....vbscript. Very easy to call the cmd, pipe the data to a text file. Then read the file, one line at a time, and call the dsmove for each one.
 

Bud Guy

Senior member
Nov 4, 1999
235
0
0
Thanks for the replies. Looks like I need to do some reading up on scripting.

Any book recomendations?

Thanks,
Shane