In need of a Powershell script to move students from an OU to another OU

Good Day Everyone,
I was tasked to move students from the Students OU to Full Time / Part Time OU. I can possibly get this done in a short time BUT since I am a newbie, I would like to know what would be the best approach for me to get this done. 
Details
1. There are about 1700 students
2. Import Students from an CSV file to be moved [fulltimestudents.csv AND parttimestudents.csv]
3. After importing the students > move them to the fulltime or parttime OU
Any suggestions before I start this and thank you all for your help.
AM
Adrian Mohamed

Good Morning JRV + All,
Here is a working code that I am now using for the move - any ideas on how to clean it up + maybe w/ comments would be much appreciated.
remove-variable
* -force
Remove-Item
-Path C:\temp\out.txt
-Force
$FULLTIMEOU='OU=Full
Time,OU=Undergraduate,OU=Students,OU=Users,OU=LIM Objects,DC=limcollege,DC=edu'
$PARTTIMEOU='OU=Part
Time,OU=Undergraduate,OU=Students,OU=Users,OU=LIM Objects,DC=limcollege,DC=edu'
clear
# Import users from Carolyn’s CSV file [separate files for Full Time + Part Time]
$user
= ipcsv
-path C:\temp\test2.csv
# Get all students distinguished names > output them into a single file
# Output to a txt gives us a paper trail of the actual students being moved
foreach ($users
in $user)
    (Get-ADUser
$users.name).distinguishedname
| Out-File
C:\temp\out.txt -Append
# Wait until the above transactions are complete
Start-Sleep
-s 2
# Import the distinguished names > make the move to new OU
$name
= Get-Content
-Path C:\temp\out.txt
# Reiterate through the student names and perform the move
foreach ($names
in $name)
Move-AdObject -Identity
$names -TargetPath
$FULLTIMEOU
Adrian Mohamed

Similar Messages

  • Script to move computers from one ou to another based on os

    hi there
    I am looking for a script to move computers from specific  ou to another based on their OS.
    thanks

    Hi,
    Have you checked here yet?
    http://gallery.technet.microsoft.com/scriptcenter
    There should at least be a starting point for you if you don't find exactly what you're after.
    Don't retire TechNet! -
    (Don't give up yet - 12,420+ strong and growing)

  • Script to move computers from one ou to another based on their operating system

    I am looking for a script to move computers from one ou to another based on their operating system
    I tried the followings
    1- dsquery * CN=Computers,ou=test1,DC=mypc,DC=com -filter "(&(ObjectClass=computer)(objectCategory=Computer)(operatingSystemVersion=5.1))" | dsmove -newparent OU=test2,DC=mypc,DC=com
    I got the following error
    dsquery failed:Directory object not found.
    type dsquery /? for help.dsmove failed:'Target object for this command' is missing.
    type dsmove /? for help.
    2-dsquery * ou=test1,DC=mypc,DC=com -filter "(&(ObjectClass=computer)(objectCategory=Computer)(operatingSystemVersion=5.1))" | dsmove -newparent OU=test2,DC=mypc,DC=com
    I got the following error
    dsmove failed:'Target object for this command' is missing.
    type dsmove /? for help.
    anybody can help me on this please

    This is what a good query will look like.  Note the extra bits in the version. (7601)
    dsquery * "dc=kahlnet,dc=local" -filter "&((objectclass=computer)(operatingSystemVersion=6.1 (7601)))"
    ¯\_(ツ)_/¯

  • Powershell Script to move an AD user account to another OU

    Hi Everyone
    I have been searching for this script a long while so if you are having the same problem here is the solution:
    Given only a samaccount name/username, ths script will find the location of the user account and move it to the OU that you want:
    # Given just the username/samaccountname (Andre), the location of the user object is found
    # and the account is then moved to the NewOU
    $UserName = "Andre"
    # Finding the location of the user account Andre:
    $Root = [ADSI]''
    $searcher = new-object System.DirectoryServices.DirectorySearcher($root)
    $searcher.filter = "(&(objectClass=user)(DisplayName= $UserName))"
    $User = $searcher.findone()
    # Binding the user account to $AUser and the OU to move to to $MovetoOU
    $ADSPath = $User.Properties.adspath
    $MoveToOU = [ADSI]("LDAP://OU=NewOU,DC=mydomain,DC=com")
    $AUser = [ADSI]("$ADSPath")
    # Command to Do the actual move
    $AUser.PSBase.moveto($MoveToOU)
    # Send me some comments.

    I like a method like this...
    Import-Module ActiveDirectory
    get-aduser -filter {<What ever your search criteria is> } | %{move-ADObject $_.DistinguishedName -targetpath 'OU=NewOU,DC=Contoso,DC=Local'}
    Works on Server 2008 R2 domain controllers, and RSAT tools on Windows 7 with SP1 when you have the AD powershell portion installed. Does not work with Server 2003 domain controllers or earlier.
    I use that, but I don't care for having to type out the entire DN of the target OU if I'm working from the console.
    I have this in my profile:
    function Get-OU ($Name)
    { Get-ADOrganizationalUnit -filter "Name -like '*$Name*'" |
    Out-GridView -OutputMode Single
    So I can do this:
    Import-Module ActiveDirectory
    get-aduser -filter {<What ever your search criteria is> } |
    %{ move-ADObject $_.DistinguishedName -targetpath (Get-OU Test).DistinguishedName }
    And I'll get a grid view of all of the Test OUs, and I just pick the one I want from the gridview.
    [string](0..33|%{[char][int](46+("686552495351636652556262185355647068516270555358646562655775 0645570").substring(($_*2),2))})-replace " "

  • I have bought a new Mac Book Pro, and I need to know how I can move Aperture from my old Mac Book to the new one..

    I have bought a new Mac Book Pro, and I need to know how I can move Aperture from my old Mac Book to the new one..

    It begins with: F-285-NER-151-QBQ-and continues with 5 more 3 or 4 letters/numbers..
    Yes, that is the number. And what version of Aperture have you installed? The same version as on your old Mac?
    But it don´t work on my new Mac...
    In what way does it not work? Does it require you to enter a licence number for Aperture 2 as well? That will be necessary, if your serial number is an upgrade serial number. Then you will have to enter all previous numbers as well.
    Or does Aperture not accept the number as correct? Then check the spelling; some letters are easily confused like "I" and "1" and "O" and "0". Do not use the number pad to enter the numbers.
    See: Troubleshooting Professional Application Serial Numbers
    Regards
    Léonie

  • A way to move layers from one file to another in actions?

    Ok, question for the gurus out there - rather than try to explain, I'll give you an example: Lets say I have a series of adjustment layers that I want to apply to a sequence of 40 images. The adjustments are in a layer group, and are saved as a separate file.
    I DON'T want to drag and drop them, I want to run an action that will copy the adjustments to each image- now I know I can save down each adjustment as a separate file, lets a curve (acv) a selective color (ahu) file and load THAT in as part of my action. But I don't want to do that either, because these adjustments will change and I want to easily re-render my changes on all 40 images in one step.
    I also don't want to use After Effects to do it, because my client doesn't own it. There used to be
    a way to move layers from one file to another in actions because I seem to remember doing it. The answer is not Duplicate Group either because that needs you to specify a destination file name.
    Is it possible to do this without scripting? I'm pretty sure it used to be because I seem to remember doing it, just cant remember HOW I did. Maybe I'm wrong about this though.
    Thanks and sorry for the long post, this has been baffling me for weeks.

    Thanks Ed, but as I explained above
    "I know I can save down each adjustment as a separate file, lets a curve (acv) a selective color (ahu) file and load THAT in as part of my action. But I don't want to do that either"
    What I want to know is is there a way to move adjustment layers from one file to another in an action. I know also that you can use the clipboard to move pixel layers, but I've yet to find a way to move adjustments.

  • [CS3 JS]  Move pages from one document to another?

    First, a brief explanation of what I am trying to do. I have several individual chapters that I am including in an INDD book. However, I also want to be able to allow those individual chapters to stand alone, meaning that I want to add a cover/title page to each chapter file (these two pages would be placed before the current page 1 of each chapter).
    My preference would be to write a script that would open the cover/tp file and open the first chapter file; this part is no problem. Where I am running into trouble however, is the second step: moving the cover/tp pages (2 pages) over into the chapter file.
    Manually, I would open Cover.indd, activate the "move pages" menu, "Move pages: 1-2", "Destination: Before_Page 1", "Move to: Chapter1.indd".
    With over 100 chapters in the book, however, I would prefer to automate the process. I have looked into the Page.move and PageItem.move elements, but both look like they would require a location in the current document (either in (x,y) form or using "AT_BEGINNING".
    If I cannot get this to work, I will likely try to insert two blank pages, then cut/paste with a script, but I would prefer the "move" functionality, if it is possible.
    A couple of answers to potential questions:
    I can't simply place the INDD cover file b/c it uses a text variable to pull the chapter name; this personalizes each stand-alone chapter.
    Same answer to why I can't just slap the 2-page .pdf on the front of each. I need the text variable to still be active.
    Has anyone tried to move pages from one document to another using scripting? I tried to explain what I am trying to do, but if it doesn't make sense, I can try again. :)
    thanks!
    Matt

    ok here we are
    I get a raw skeleton that you will have to adjust but it's functional.
    Use a PDF for placement as you can specify the page that you want to place.
    I don't know if you can do the same for indesign files.
    So basically, it starts adding 2 pages and placeing the pdf in the same time.
    After that, it creates the textVariable and the frame that will receive it.
    Here you are:
    //If a document is open
    if(app.documents.length!=0)
    var ad = app.activeDocument;
    //Pages placement
    for(i=0; i<2; i++)
    //Add 2 pages on top of the document;
    var tmpPg = ad.pages.add(LocationOptions.BEFORE, ad.pages[0]);
    //Here you place your pdf
    app.pdfPlacePreferences.pageNumber = i;
    tmpPg.place(File(cover.pdf), false)
    //You should specify page x and page y but ain't found yet the way to go.
    //Text variable creation
    //Check if the textVariable named "txtVar" does not already exist...
    if(ad.textVariables.item("txtVar")==null)
    //if not found, create the text variable named "txtVar"
    var txtVar = ad.textVariables.add();
    txtVar.variableType =VariableTypes.CUSTOM_TEXT_TYPE;
    txtVar.name = "txtVar";
    //Set the contents of the text variables to the string "test"
    ad.textVariables.item("txtVar").variableOptions.contents = "test";
    //these coordinates don't care aboutyour units but you may adjust them to your needs
    var y1 = ad.marginPreferences.left;
    var x1 = ad.marginPreferences.top;
    var y2 = y1+5;
    var x2 = x1+25;
    var myFrame = ad.pages[0].textFrames.add({geometricBounds:[y1,x1,y2,x2]});
    //Set the contents of the frame to the text variables "txtVar"
    myFrame.contents=ad.textVariables.item("txtVar").variableOptions.contents;
    //You may want to stylize the txtVar
    //In this case, either you use a existing characterStyle or you create one in the script
    Bye Loic

  • Move files from one folder to another javascript?

    I am running a 3-action droplet automatically using windows task scheduler.  Here are the 3 steps:
    1.    Batch file to move files from hot folder to processing folder
    2.    Run IPP (dr brown's image processor pro) using preloaded settings to make several sizes copies of the files.
    3.    Bat file to move the files from processing folder to archive folder.
    The problem I am observing is that Step 1 works and IPP begins to run.  It only processes the first few images, and then moves on to the 3rd step where the bat file is ran to move all files from processing folder to archive folder.   The trouble is, only a few images were processes (about 10 or so), yet all of the images get moved to the archive without being processed.  Is there a way to make sure that step 2 (IPP) doesn’t begin until all files have successfully been moved from the hot folder to the processing folder?  IPP starts right away and files are still being transferred to the processing folder.
    Does anyone have a script that will move files from one folder to another? 

    I'm sure I have see a way to close down Photoshop in a Photoshop script.  I never had the need to.  It may be a simple statement like app.close(); I don't know javascript and only hack Photoshop script mostly by looking at others code.  app.close(); is a guess on my part. Let me try it. I was wrong its photoshop.quit();
    So make your MoveToArchive.jsx look something like this
    try{
       var BAT = new File(Folder.temp + "/MoveFilesToArchive.bat");
       BAT.open("w");
       BAT.writeln('Copy /Y "c:\\Process\\*.jpg" "c:\\Archive\\*.*"');
       BAT.writeln('Del "c:\Process\\*.jpg"');
       BAT.close();
       BAT.execute();   // execute the temp bat file
    }catch(e){
    alert("Bat MoveFilesToArchive  failed to execute.");
    photoshop.quit();

  • How do I move pictures from one library to another?

    How do I move pictures from one library to another?

    For just a few export them out of Library A via the File ➙ Export ➙ File Export menu option with Kind = Original and import them into Library B.
    However, this will not include any edits or metadata (keywords, titles, etc.) that you've added.
    To get the original image, any edits and all metadata, keywords, titles, descriptions, places, etc., you'll need the paid version of  iPhoto Library Manager.  It can copy albums or events from one library to another and keep those items I mentioned earlier with the photos.
    OT

  • Move files from one folder to another

    I am brand new to the application and have spent a ton of time googling various topics, but need some additional help. Seems easy enough, but I can't figure out how to do it...
    I would like to move pics from one folder to another. I can drag files from one folder to another, but they still reside in the original folder as well. Is there a way to cut and paste or a similar function to accomplish this move?
    Thanks.

    Hey, HawaiianHaole, as a multidecade Mac user, let me tell you, Aperture is about the worst example of Mac-iness one could imagine. Ironic, as it's (of course) made by Apple. But it is so inflexible, and insists so vociferously on making the user learn its peculiar interface conventions it reminds me most of something out of that famous company in Redmond.
    Want your Projects in an order you choose? Sorry! Want to arrange your windows so you can see your list of chat buddies while you're working in Aperture? Nope, can't do it! Aging eyes have trouble reading tiny grey type on a grey background? Hey buddy, it was your choice to grow old, don't blame us!
    But all is not lost. Aperture has gotten considerably better of late (versions up to 2.0 were fundamentally unusable in many ways) and will hopefully continue to improve. (ie Maybe they'll fix the printing thing...)
    Please don't make Aperture the basis for your judgement of the Mac OS. Many long time Mac users are having as much trouble with Aperture as you. Mac OSX has significantly reduced customizability but at the benefit of much improved stability and indeed usability. Old school Mac users had to learn to accept this, which most did. You'll hear people talk about the "Way of the Steve". As irksome as Aperture can be, you'll actually have a better time of it if you adopt the Way of the Steve, and accept that you can't do things the way you might want to. This is imho antithetical to the original Mac many of us knew and loved, but it's the way things are today, so we mostly shut up and take it. You can fight with your software all day, or just accept that there are ways you have to adopt and adapt to them.
    Welcome to the Bright Side, hope your Mac experience improves.

  • How do you move pictures from one album to another

    how do you move pictures from one album to another?

    Pictures can appear in any number of albums.
    To move from one album to another, add the picture to the new album and then right click on the picture, select Remove from album and then select the album you want to remove it from.
    If you need further help, please let us know which version of Photoshop Elements you are using and which operating system you are running on.
    Brian

  • How to move cursor from one textfield to another textfield byusing enterkey

    hii all,
    I have a problem in java script.
    To move cursor from one textbox to another text box ,I have take the length of the textboxes of the first column.I used onkeyDown event .
    in the function ,firest i checked the condition like
    for(i=0;i<form1.box.length;i++) //box is the name of the textboxes
    if(event.keyCode==13)
    form1.box[i+1].focus();
    return false;
    by using this the cursor is moving from first text box to secon textbox and stops.
    if i use event.returnValue=false; instead of return false ,then the cursor automatically going to the laxt textbox of the column.
    my problem is how i can focus the cursor from one textbox to another textbox one after the other till the end.
    if any one has solution please help me.
    also if we can do in another way also,please help me.
    thanx.>

    try the following code :
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    <HTML>
    <HEAD>
    <TITLE> New Document </TITLE>
    <META NAME="Generator" CONTENT="EditPlus">
    <META NAME="Author" CONTENT="">
    <META NAME="Keywords" CONTENT="">
    <META NAME="Description" CONTENT="">
    </HEAD>
    <SCRIPT language="Javascript">
    function fnTest(str)     {     
              if(event.keyCode==13)          {
                   if(str == 4)     {
                        formHeader.box[0].focus();
                   else     {
                        formHeader.box[parseInt(str)+1].focus();
                   return false;
    </SCRIPT>
    <BODY>
    <FORM name="formHeader">
    <CENTER>
    <INPUT TYPE="TEXT" name="box" value="" onKeyDown="javascript:fnTest('0');">
    <br>
    <INPUT TYPE="TEXT" name="box" value="" onKeyDown="javascript:fnTest('1');">
    <br>
    <INPUT TYPE="TEXT" name="box" value="" onKeyDown="javascript:fnTest('2');">
    <br>
    <INPUT TYPE="TEXT" name="box" value="" onKeyDown="javascript:fnTest('3');">
    <br>
    <INPUT TYPE="TEXT" name="box" value="" onKeyDown="javascript:fnTest('4');">
    </CENTER>
    </FORM>
    </BODY>
    </HTML>
    ----------------------------------------------

  • Move text from one artboard to another

    Hi I have 3 artboards open and am trying to move text from one artboard to another, each piece of text is on a different layer, but when I use the selection tool and just drag it across to the next artboard, nothing shows up.  How do I move text from one artboard to another?  Thanks

    Dont worry I now have it sussed.  I just needed to move the layers up in the stacking order.

  • Move data from one member to another existing member

    Can someone please advise how I can move data from one member to another existing member?  For example, I have data in member ID MT_160 and I want to move this data over to an existing member MT_130 as per business requirement.  How can I accomplish this?  I tried using the NEWID field but system complained that the new ID must be Unique, which makes sense.  I'm stuck now.  Any Ideas?  I'm using BPC version 5.0 on Microsoft.
    Thanks.

    David,
      one  of  the  ways  you  can  achieve  the  desired  result  is  Via  BPC  Excel
    1) from  menu Edata--> RUn  Package --> copy/Move .  OR
    2) You  an  write  Script  logic  to  Copy/Move  data.
    Hope this  helps..

  • Move Photos from one Library to another

    How can I move pictures from one library to another in Iphoto 11 ?

    1. Export from one, import to the other. Though you will not get all the versions if you do this. You also need to be sure to sue the options in the Expor dialogue to write all the metadata to the files or that won't come over. Note there is no way to export Faces data.
    2. Use iPhoto Library Manager to move the files and all versions and all metadata - including Faces - between libraries. However this hasn't been fully updated for iPhoto 11 so you'll need to wait a few days.
    Regards
    TD

Maybe you are looking for