• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

Stash... I have a question for you.

Bud Guy

Senior member
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.
 
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?
 
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!
 
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.
 
You might find something at Clarence Washinton's Win32 Scripting site. A web search will find it.
 
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?
 
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.
 
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.
 
Thanks for the replies. Looks like I need to do some reading up on scripting.

Any book recomendations?

Thanks,
Shane
 
Back
Top