Powershell for AD shadowgroups problem

Here is my script. It is well commented, but let me know if something doesn't make sense.Problem - If there are more groups than there are OUs, then the script gets kind of an off-by-one problem and starts putting Sales Computers in the Support-Computers group, etc...I solved this problem by compairing the number of Shadow Groups to the number of unique OUs, and if there are more groups than OUs (like in the case when maybe we merge 2 departments/OUs, or when we rename or remove OUs) it deletes all the shadow groups, and re-creates them. The problem with deleting groups and recreating them is when things like Group Policy, NPS, or File System ACLs use these groups, because they are dependant on the SID, everything gets lost. Can you help me figure out how to keep my shadow groups in sync with the OUs they mirror (both ways) without...
This topic first appeared in the Spiceworks Community

Include the Import-Module statement at the top of your script.

Similar Messages

  • PowerShell for Office 365 is here – here's how to use it

    After announcing its intention to release new scripts and commands to better integrate PowerShell with Office 365,Microsoft has followed through.The newly ordained PowerShell for Office 365 features the same command-line interface found in PowerShell 5.0 – and that's because it is the same program.According to The Register, Microsoft has created "ascript libraryto help you do things like add users, control licenses, and stop people from recording Skype meetings."Before you start using it, however, you have to "import the modules corresponding to all the bits of Office 365 you want to administer, including the Microsoft Online Services Sign-in Assistant and the Azure Active Directory Module to handle the important matters of security and authentication."The widespread use of PowerShell and its necessity for sysadmins and network admins...
    This topic first appeared in the Spiceworks Community

    Hi, almightywiz,
    Sorry for the delayed response. I was away from office for one day and did not have access to the files.
    And you are right, column 11 is text and column 26 is date (i.e., numeric). And indeed, those visually blank cell in column 11 are not null but have zero length. Java can tell the difference but not by visually inspecting the cells in the spreadsheet.
    I also checked the POI API documents, and found that org.apache.poi.ss.usermodel.Cell interface, which has those cell types, is implemented by both HSSFCell and XSSFCell. The question is under what condition the cell type of a cell becomes Cell.CELL_TYPE_BLANK.
    While that is not yet clear, I will catch cells missing data in column 11 by checking three things: first check if(cell == null), then if(cell.getCellType() != Cell.CELL_TYPE_STRING), and then if(cell.getStringCellValue().length() == 0). And that solves my problem.
    Thank you so much for sharing your experience and solving my problem.
    I have another problem that may more serious, at Can I process Excel BIFF5 files, or simply abandon Apache POI? It would be very much appreciated if you had time to look at it.
    Best regards,
    Newman

  • Powershell for to list SQL Server Windows Groups

    Hi All:
    I m planning to write a script, to pull SQL Server Windows Groups members list by using powershell.
    By using dsa.msc i can view the members of a particular SQL widows groups., the same i want to do using powershell., is there any way to do this. I want to run this from remote machine.
    Please let me know how can we do this and per-requist... Already installed PowerShell 3.0 and loaded the recommended modules on it.
    Thanks,
    Satish Kumar.
    Thanks, Satish Kumar. Please mark as this post as answered if my anser helps you to resolves your issue :)

    Hi,
    I was able to run the command on the other machines with no problem. Have you tried right-clicking, Run As Administrator?
    According http://blogs.technet.com/b/heyscriptingguy/archive/2011/08/29/use-active-directory-cmdlets-with-powershell-to-find-users.aspx
    “This warning message: “WARNING: Error initializing default drive: 'Unable to find a default server with Active Directory Web Services running.'” is generated because I have several domain controllers, and not all of them have
    the
    Active Directory Management Gateway Service installed. Depending on which domain controller authenticated my workstation, the warning appears. The solution is to install the Active Directory Management Gateway Service
    on all of the non-Windows Server 2008 R2 domain controllers. The other solution is to ignore the warning and specify the
    server parameter each time when using one of the cmdlets (but that will mean the PSDrive will be unavailable).”
    In addition, this issue is more related to PowerShell, for quick and accurate answers to your questions, it is recommended that you initial a new thread in our PowerShell forum for dedicated help.
    http://social.technet.microsoft.com/Forums/windowsserver/en-US/home?forum=winserverpowershell
    Thanks.
    Tracy Cai
    TechNet Community Support

  • Will there be a fix for Firefox's problems with Hotmail. I have gone back to 3.5.9 but mostly I am disappointed by the lack of action on this serious problem where a major and critical feature of a major international website is unavailable in the Firefox

    Will there be a fix for Firefox's problems with Hotmail. I have gone back to 3.5.9 but mostly I am disappointed by the lack of action on this serious problem where a major and critical feature of a major international website is unavailable in the Firefox browser.
    == URL of affected sites ==
    http://www.hotmail.com

    We've reached out to the Hotmail team and they've determined that this is a bug in their code. (It was masked by a timing issue in 3.5 that was fixed in 3.6.) We've worked with them to develop a fix but they may not have deployed it yet.

  • Firefox crashing when i wanna open or close a tab or a window, also while wanna open any page, now what to do for solving the problem?

    Firefox crashing when i wanna open or close a tab or a window, also while wanna open any page, now what to do for solving the problem?

    Disable McAfee siteadvisor and check the problem still persist or not?

  • I updated the software on my 2009 MBP to Mountain Lion. Since then, my iPhoto has been unable to open my photo library. I have updated iPhoto, and still no luck. Any ideas for fixing this problem?

    I updated the software on my 2009 MBP to Mountain Lion. Since then, my iPhoto has been unable to open my photo library. I have updated iPhoto, and still no luck. Any ideas for fixing this problem?

    Welcome to the Apple Support Communities
    Do you see any message when you open iPhoto? Try to open iPhoto holding Option key and select the library

  • A solution for iTunes install problems

    I upgraded to the latest ver of iTunes and immediately had ALL the problems posted all over the 'net.
    The following is what worked for me.
    BACKUP!!! Set a Restore Point. Back up your REGISTRY. It is critical that you back it up beforehand and use caution while cleaning it. Please do this in case everything goes T. U.
    Remove all references to iTunes, iPod and Quick Time. There are literally thousands and you must get rid of all of them.
    Find, download, install a copy of jv16 Power Tools.
    Then:
    1. BACKUP! Set Restore Point! Back up your Registry! Did I mention backing up?
    1a. Be very careful cleaning out the Registry. Take your time. Go slowly. Make sure that what you delete is only iTunes-related. Check twice before deleting. Take. Your. Time.
    1b. The Registry is your PCs mind; do not scramble it. You will be sad.
    2. Using jv16s Software Manager, uninstall iTunes, iPod and Quick Time.
    3. Using jv16s Registry Finder, one at a time, search for and delete ALL references to iPod, iTunes, Quick Time and Apple Computer (BE CAREFUL; it will give you references to various 'applets" and "appletalk"; do NOT delete those. Only Apple Computer stuff.)
    4. Using Microsofts Search function, search for all remaining references to iTunes, iPod, Apple Computer (leave applets alone) and most importantly-Quick Time.
    5. When you are certain that everything that says Apple Computer, Apple, iPod, iTunes and Quick Time exists no more on your PC, Reboot.
    6. Go to www.old-software.com and download an old copy of iTunes. The one that finally worked for me was iTunes v 6.0.5
    7. Install an old version of iTunes. DO NOT USE THE LATEST VERSION OF iTUNES! Thats what caused the problems in the first place.
    8. Reboot.
    Even though you previously "uninstalled" iTunes, probably using the Add Remove Programs application in Control Panel, there remains behind thousands of pieces, parts and references to iTunes and Quick Time, in the Registry, TEMP files, Documents and Settings (Application Data and Local Settings), in Windows/system32 and a hundred other places. You gotta get rid of it all.
    Quick Time seems to be the main culprit, but in the end I had to get rid of all traces of all of the Apple applications before I could install again and get it to work.
    It took me 3 days to figure out this procedure but once I did, it took only an hour to do it.
    I've seen a couple other procedures recently posted here that look good. If you are uncomfortable with going into the Registry, try one of those others first.
    And fer cryin' out loud, Apple. Yank the latest version of iTunes off your site. I did a Google search for "iTunes installation problems" and came up with 700,000 hits. Do ya think you might have a problem?
      Windows XP   Try testing your upgrades before releasing them!

    Im trying your method right now, when im finished ill let you know how it worked out. I agree with your comment on apple needing to pull the latest version and get a version that actually works.

  • Hard Drive warning when upgrading to Mountain Lion. 2 try and I was able to upgrade. Software update for IPhoto, had problems restarting. Do I need my hard drive checked

    Hard Drive warning when upgrading to Mountain Lion. 2nd try and I was able to upgrade. Software update for IPhoto, had problems restarting. Do I need my hard drive checked

    Yes.
    Choose Apple menu > Restart. Hold down the Command (⌘) and R keys as your computer restarts.
    When you see a white screen with an Apple logo in the middle, you can release the keys.
    Click Disk Utility, and then click Continue.
    In the list at the left, select the item you want to repair. (Be sure to select an item that’s indented to the right in the list, not an item at the far left.)
    Click First Aid.
    If Disk Utility tells you the disk is about to fail, back it up and replace it. You can’t repair it.
    Click Repair Disk.
    If Disk Utility reports that the disk appears to be OK or has been repaired, you’re done.
    Otherwise, you may need to do one of the following steps.
    If Disk Utility can’t repair your disk or it reports “The underlying task reported failure,” try to repair the disk or partition again. If that doesn’t work, back up as much of your data as possible, reformat the disk, reinstall Mac OS X, and then restore your backed-up data.
    If you continue to have problems with your disk, it may be physically damaged and need to be replaced

  • When will there be a fix for the permissions problem in iTunes 11.1.1? I get a list of three or four-hundred when I run the repair program.

    Does anyone know when will there be a fix for the permissions problem in iTunes 11.1.1? I have a list of three to four hundred repairs everytime I use the repair program. ~Mike.

    SinkeMH wrote:
    Does anyone know when will there be a fix for the permissions problem in iTunes 11.1.1
    Likely someone does but Apple has not stated if/wehn.
    I have a list of three to four hundred repairs everytime I use the repair program. ~Mike.
    Then don't use the repair program unless you are actually having an issue.

  • Buy my problem of camels Store Lee games possible solution for me my problem?

    Buy my problem of camels Store Lee games possible solution for me my problem?

    This worked for me, sort of. A while back when I downloaded that windows update that installed the new version of IE, I noticed that IE wouldn't connect to the internet and pages wouldn't load. However, I thought nothing of it because I use Firefox and FF was working just fine.
    I went into IE earlier this evening (it still wasn't working) and tried to follow your recommended steps. I got up to step 4 and IE froze. I tried closing it, reopening it and repeating the steps but it would always freeze at step 4. In another thread, someone was saying that iTunes released a security update and that fixed the store for them so I tried opening Apple Software Update and that froze. I tried it several times, nothing. Would always freeze. I even tried updating thru iTunes and IT would freeze.
    Finally, I went to the control panel and uninstalled IE7. The iTunes store and the Apple Software Update program are now working! So thank you very much for your suggestion. Otherwise, it may have never clicked with me that IE was the problem.
    Windows XP

  • Will I get my iPhone replaced for yellow tinting problem

    Will I get my iPhone 4S replaced for yellow tinting problem, it's hardly 6 months old phone and this problem is from day one. Screen is not whitish it's yellowish.

    If you think there is a problem with the screen, try making a reservation with a Genius.

  • I loaded Mac OS X v10.7 Lion yesterday. Everything's running fine, except for a simple problem. Any time I want to copy a file, JPEG, etc., I am prompted "Finder wants to make changes. Type your password to allow this." I don't want this!! Is there a way

    I loaded Mac OS X v10.7 Lion yesterday. Everything’s running fine, except for a simple problem. Any time I want to copy a file, JPEG, etc., I am prompted “Finder wants to make changes. Type your password to allow this.” I don’t want this!! Is there a way to unlock “Finder” or rid this process?

    Back up all data.
    This procedure will unlock all your user files (not system files) and reset their ownership and access-control lists to the default. If you've set special values for those attributes on any of your files, they will be reverted. In that case, either stop here, or be prepared to recreate the settings if necessary. Do so only after verifying that those settings didn't cause the problem. If none of this is meaningful to you, you don't need to worry about it.
    Step 1
    If you have more than one user account, and the one in question is not an administrator account, then temporarily promote it to administrator status in the Users & Groups preference pane. You can demote it back to standard status when this step has been completed.
    Triple-click the following line to select it. Copy the selected text to the Clipboard (command-C):
    sudo chflags -R nouchg,nouappnd ~ $TMPDIR.. ; sudo chown -R $UID:20 ~ $_ ; chmod -R -N ~ $_ 2> /dev/null
    Launch the Terminal application in any of the following ways:
    ☞ Enter the first few letters of its name into a Spotlight search. Select it in the results (it should be at the top.)
    ☞ In the Finder, select Go ▹ Utilities from the menu bar, or press the key combination shift-command-U. The application is in the folder that opens.
    ☞ Open LaunchPad. Click Utilities, then Terminal in the icon grid.
    Paste into the Terminal window (command-V). You'll be prompted for your login password, which won't be displayed when you type it. You may get a one-time warning not to screw up. If you don’t have a login password, you’ll need to set one before you can run the command.
    The command will take a noticeable amount of time to run. Wait for a new line ending in a dollar sign (“$”) to appear, then quit Terminal.
    Step 2
    Boot into Recovery by holding down the key combination command-R at startup. Release the keys when you see a gray screen with a spinning dial.
    When the OS X Utilities screen appears, select
    Utilities ▹ Terminal
    from the menu bar. A Terminal window will open.
    In the Terminal window, type this:
    resetpassword
    That's one word, all lower case, with no spaces. Then press return. A Reset Password window will open. You’re not going to reset a password.
    Select your boot volume ("Macintosh HD," unless you gave it a different name) if not already selected.
    Select your username from the menu labeled Select the user account if not already selected.
    Under Reset Home Directory Permissions and ACLs, click the Reset button.
    Select
     ▹ Restart
    from the menu bar.

  • Is there a fix for the WIFI problem with Lion? How can I get Lion off of my Mac?

    Is there a fix for the WIFI problem with Lion? How can I get Lion off of my Mac?

    gmiller0 wrote:
    My mac has 10.7.3 and will not connect to wifi after it wakes up. Have contacted AppleCare but the problem cannot seem to be resolved.. I guess this is a major issue with Lion:(
    What model of Mac?  I have a MBP running 10.7.3 and do not have that issue.  From the other couple of posts I've seen about it, it seems to be maybe an issue with some iMacs?  Have your tried searching the Lion or iMac forums for similar issues, just to see if anyone has hit on why it is happening?

  • Trying to get assistance for a connection problem ...

    First, let's get this straight. No, restarting the router has no effect on the connection (as the 'technical' help desk advised me 3 times in a row). 
    Please see previous thread for when the problems started occuring:
    http://community.bt.com/t5/BT-Infinity/Service-has-been-great-for-a-week-ping-loss-after-big-disconn...
    Since then I have been in pretty much regular contact with someone from this forum called Stuart. I must commend his commitment to trying to solve the problem, including one engineer visit a few months ago which I wasn't charged for, but still the problem persists.
    Tonight the line is atrocious, unusable. 
    tracert to one of the new FFXIV servers: http://i.imgur.com/Wx3sWgp.png (packet loss exhibited on hop 3 and 4 a few minutes after i uploaded the screenshot)
    TBB to my IP: http://i.imgur.com/rlilqpr.png
    The random disconnects, the packet loss, the random latency... it's disgraceful. BT have had enough time to sort this out (I reported it in April), and still I'm being charged full price for this line. The problem doesn't appear to be with the connection to my house specifically, but anything past the local exchange. Who can I speak to so I can get some sort of a refund on this...I'm well within my rights to terminate the contract with this kind of service, and I'm seriously considering doing so.

    I would suggest you continue with mod help as they are only bt employees on the forum and from your posts you need bt assistance
    If you like a post, or want to say thanks for a helpful answer, please click on the Ratings star on the left-hand side of the post.
    If someone answers your question correctly please let other members know by clicking on ’Mark as Accepted Solution’.

  • How to create sharepoint Group with read only permissions using powershell for entire site ?

    How to create sharepoint Group with read only permissions using powershell for entire site (including subsites and top level site)

    Hi
    using (SPSite site = new SPSite(url))
    using (SPWeb web = site.OpenWeb())
    SPUserCollection users = Web.AllUsers;
    SPUser owner = users[string.Format("{0}{1}", "Domain", "Owner Username")];
    SPMember member = users[string.Format("{0}{1}", "Domain", "Default Member Username")];
    SPGroupCollection groups = Web.SiteGroups;
    string GroupName = “Super Exclusive”;//your group name
    string GroupDescription = “Super exclusive group description.”;
    groups.Add(GroupName, owner, member, GroupDescription);
    SPGroup NewSPGroup = groups[GroupName];
    SPRoleDefinition role = Web.RoleDefinitions["Read"];
    SPRoleAssignment roleAssignment = new SPRoleAssignment(NewSPGroup);
    roleAssignment.RoleDefinitionBindings.Add(role);
    Web.RoleAssignments.Add(roleAssignment);
    Web.Update();
    Please 'propose
    as answer' if it helped you, also 'vote
    helpful' if you like this reply.

Maybe you are looking for

  • IPod headphones no longer working

    I have an 8 GB, 2nd generation iPod nano, which I purchased around three years ago. Around early April last year, the headphones that came with the nano crapped out. Sound only came from the right earpiece. Assuming any kind of warranty that came wit

  • Apple TV, monitor use and lag time with mouse and keyboard

    I purchased an Apple TV so that I could use one monitor to switch between my Mac Mini and my MacbookPro. The monitor is hardwired to the Mini, but the MacbookPro uses airplay. My wireless mouse and keyboard lag with this setup. Is there a way to fix

  • Webservices in Adobe form fails even when it works fine in Portals.

    Hi All, I am new to web services in adobe form, can somebody help me to understand the reason of failing web service call in my adobe form. We are working on a simple adobe form with a simple webservice.  the web service is in SAP CRM 7.0 and we are

  • Has Siri come out on IPad 3 yet?

    has Siri come out on IPad 3 yet?

  • Streaming Webcam freezes in Safari after Mountain Lion Update

    A friends url that has his streaming webcam stopped working in Safari after I installed the latest update to Mountain Lion on my MBA. If I reload the page, the clock updates, ticks for 1 second and then freezes again. The webcam site still works with