Get-AdGroupMember Question

OK here's my problem, I'm not great with PowerShell. I understand a little but that's about it and here's me scenario.I am creating a process to add users to a domain local group but it is spread across 3 domains. My add script works like a charm but I need to add some error checking in so I want to check if the user is already a member first, if they aren't add them and then test to ensure they were actually added. If I use Get-ADUser it only looks at the user in that domain so does not show the user being a member of that group as it sits in another domain.if ((Get-ADUser $UserName -server $DomainController -Properties memberof).memberof -like $GroupDN){1}Else{0}So I think I need to do it the other way, search the group and then establish if the user is listed. I know I can use the Get-ADGroupMember function but that only returns a...
This topic first appeared in the Spiceworks Community

Hi,
Based on the description, you have deleted the object for mail-enabled public folder "Equipment Contacts" under the Microsoft Exchange System Objects container, but you still get the warning provided above.
First please check if you have other mail-enabled public folder object under the Microsoft Exchange System Objects container, make sure they have a valid alias.
Besides, please update your public folder to check result.
A similar thread for your reference.
https://social.technet.microsoft.com/Forums/en-US/749276ac-b25c-4cb5-a033-9be51cbd28c8/getmailpublicfolder-lot-of-errors-with-aliases?forum=exchangesvrdeploylegacy
Best regards,
Belinda Ma
TechNet Community Support

Similar Messages

  • PowerShell script : Directory object not found error in Get-ADGroupMember

    I am new in powershell scripting. I am writing a script to add users in different AD Groups. while doing so I do the following:
    Check if the user already exist in the group:
    $mbr_exist = Get-ADGroupMember $grpname | Where-Object {$_.SamAccountName -eq $sam}
    If user does not exist then add the user to the group.
    When I manually run the script its runs flawless, without any errors. But when I schedule the script to run it gives an error as follows:
    3/30/2015 8:32:15 AM Directory object not foundAt + $mbr_exist = Get-ADGroupMember $grpname | Where-Object {$_.SamAc ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~ Error at Line:$mbr_exist = Get-ADGroupMember
    $grpname | Where-Object {$_.SamAccountName -eq $sam}
    The strange thing is the user for which it throws the error is present in the group.I am not sure why this error is occurring when scheduled. Can any one please help? All the suggestions will be appreciated
    Note: (The script is scheduled using Windows Task Scheduler)
    try
    # # Initialize the variables we will use
    $status = 'false'
    $drivename = "H:"
    $sysdate = Get-Date -UFormat "%m_%d_%Y"
    $foldername = $drivename + "\Script_Result\PowershellData"+ $sysdate
    $backup_folder = "$foldername\AD_Groups_Backup"
    $updatedGroup = "$foldername\Updated_AD_Groups_LogFiles"
    $LogFilePath = "$foldername\Log_Update_ADGroups"+$sysdate+".log"
    # # Initialize the arrays we will use
    $GroupArray = @()
    # # maintain log of program startup
    $logdate = get-date
    $logdate.ToString() + "`tStarted script to Update AD user Groups..." | Out-File -FilePath $LogFilePath
    # # Create a sub folder to store the backup files
    $fileexist = Test-Path $backup_folder -PathType Container
    if($fileexist -ne 'False')
    New-Item -ItemType Directory $backup_folder
    # # Create a sub folder to store Updated AD group Log files
    $fileexist = Test-Path $updatedGroup -PathType Container
    if($fileexist -ne 'False')
    New-Item -ItemType Directory $updatedGroup
    # # Take back up of the AD groups data
    Get-ADGroupMember -Identity "Group1" | Export-csv "$backup_folder\Group1_BackUP$sysdate.csv"
    Get-ADGroupMember -Identity "Group2" | Export-csv "$backup_folder\Group1_BackUP$sysdate.csv"
    Get-ADGroupMember -Identity "Group3" | Export-csv "$backup_folder\Group1_BackUP$sysdate.csv"
    Get-ADGroupMember -Identity "Group4" | Export-csv "$backup_folder\Group1_BackUP$sysdate.csv"
    (an so on..... 11 such groups )
    # # Fetch AD Users data
    $ADusers = Get-ADUser -filter {(EmployeeNumber -gt 1) -and (EmployeeNumber -ne "N/A") -and (Enabled -eq $true)} -Properties * | Sort-Object -Property EmployeeNumber
    $ADusers.Count
    foreach($u in $ADusers)
    $sam = $u.SamAccountName
    $empnum = $u.EmployeeNumber
    $mgr = $u.mgr
    $fsal = $u.'fsalary-Hourly'
    $comp = $u.Company
    $ofc = $u.Office
    Write-Host "$sam : $empnum : $mgr :$fsal : $comp : $ofc" -ForegroundColor Yellow
    $GroupArray = @()
    # # Check if the user fits in any of the 11 scenarios
    if($comp -eq "US")
    # scenario 7
    write-host "7. Add to US Employees"
    $GroupArray += "US Employees"
    if($mgr -eq "Y")
    Write-Host "1. ADD to US MAnagers"
    $group = "US Managers"
    $GroupArray += $group
    if(($fsal -eq "Hourly") -and ($ofc -ne "Canton"))
    Write-Host "3. Add to US Hourly (excluding Canton)"
    $group = "US Hourly (excluding Canton)"
    $GroupArray += $group
    if(($fsal -eq "Hourly") -and ($ofc -eq "Canton"))
    write-host "4. Add to US Canton Hourly"
    $group = "US Canton Hourly"
    $GroupArray += $group
    if(($fsal -eq "Salaried") -and ($ofc -eq "Corporate" -or $ofc -eq "Landis Lakes 1" -or $ofc -eq "Landis Lakes 2"))
    Write-Host "5. Add to US Salaried Corporate"
    $group = "US Salaried Corporate"
    $GroupArray += $group
    if(($fsal -eq "Salaried") -and ($ofc -ne "Corporate" -and $ofc -ne "Landis Lakes 1" -and $ofc -ne "Landis Lakes 2"))
    Write-Host "6. Add to US Salaried Plant"
    $group = "US Salaried Plant"
    $GroupArray +=$group
    elseif($comp -eq "canada")
    # scenario 9
    write-host "9. Canada Employees"
    $GroupArray += "Canada Employees"
    if($mgr -eq "Y")
    Write-Host "2. Add to Canada Managers"
    $group = "Canada Managers"
    $GroupArray += $group
    if($fsal -eq "Hourly")
    Write-Host "10. Add to Canada Hourly"
    $group = "Canada Hourly"
    $GroupArray += $group
    if($fsal -eq "Salaried")
    Write-Host "11. Add to Canada Salaried Plant"
    $group = "Canada Salaried Plant"
    $GroupArray += $group
    elseif($ofc -eq "Corporate" -or $ofc -eq "Landis Lakes 1" -or $ofc -eq "Landis Lakes 2")
    Write-Host "8. Add to Corporate Employees"
    $GroupArray += "Corporate Employees"
    write-host "Final Group List" -ForegroundColor Green
    $grplen = $GroupArray.Length
    #$GroupArray
    $grplen
    for($i= 0; $i -lt $grplen; $i++)
    $grpname = $GroupArray[$i]
    write-host "$sam will be added to Group : $grpname" -ForegroundColor Magenta
    # # Check if the user is already present in the Group
    $mbr_exist = Get-ADGroupMember $grpname | Where-Object {$_.SamAccountName -eq $sam}
    if($mbr_exist -eq $null)
    # #Add user to US Managers group
    Add-ADGroupMember -Identity $grpname -Members $sam
    Write-Host "1. User $sam is added to $grpname group" -ForegroundColor Green
    # # documenting the user list that are added to this group
    $grpmbr = New-Object PSObject
    $grpmbr | Add-Member -MemberType NoteProperty -Name "EmployeeNumber" -Value $empnum
    $grpmbr | Add-Member -MemberType NoteProperty -Name "SamAccountName" -Value $sam
    $grpmbr | Add-Member -MemberType NoteProperty -Name "Name" -Value $u.Name
    $grpmbr | Add-Member -MemberType NoteProperty -Name "DistinguishedName" -Value $u.DistinguishedName
    $grpmbr | Add-Member -MemberType NoteProperty -Name "mgr" -Value $mgr
    $grpmbr | Add-Member -MemberType NoteProperty -Name "Company" -Value $comp
    $grpmbr | Add-Member -MemberType NoteProperty -Name "Salary/Hourly" -Value $fsal
    $grpmbr | Add-Member -MemberType NoteProperty -Name "Office" -Value $ofc
    $grpmbr | Add-Member -MemberType NoteProperty -Name "ADGroup" -Value $grpname
    $grpmbr | Export-Csv "$updatedGroup\ADUsers_To_Group($grpname)_$sysdate.csv" -Append -NoTypeInformation
    else
    Write-Host "Member $sam already exist in $grpname group" -ForegroundColor Red
    $logdate = get-date
    $logdate.ToString() + "`tCompleted script to Update Update AD Groups..." | Out-File -FilePath $LogFilePath -Append
    $status = 'true'
    return $status
    catch
    $err_lineno = $error[0].InvocationInfo.ScriptLineNumber
    $err_line = $error[0].InvocationInfo.Line
    $ExceptionMessage = $_.Exception.Message
    #$ExceptionMessage
    $error_info = $error[0].ToString() + $error[0].InvocationInfo.PositionMessage
    Write-Host "$error_info " -ForegroundColor Red
    $FailedItem = $_.Exception.ItemName
    if($ExceptionMessage)
    $logdate.ToString() + "`t $error_info " | out-file "$foldername\ErrorLog_Update_AD_Groups$sysdate.log" -append
    "Line Number: $err_lineno . `nError at Line: $err_line" | out-file "$foldername\ErrorLog_Update_AD_Groups$sysdate.log" -append
    #Invoke-Item "C:\ErrorLog.log"
    $status = 'false'
    return $status

    Hi mdkelly, Sorry for such a late reply (due to credential issues).
    I am using Windows task scheduler to schedule the task. I am given the administrator access to the server (Windows Server 2012). So I think I set to run the script under system account.
    My apologies for asking this, am I missing something while scheduling the script through task scheduler?  how to check if the scheduled task is running under who's credentials? How to pass my (admin) credentials, so that the script execution won't face
    a problem? Any suggestion on the above questions will be helpful. (I tried to search on net for the questions but didn't get any conclusive answers)  
    Thanks in advance.

  • How do I only get certain questions appear in the quiz results?

    I have created a course through Captivate 6, throughout the course there are questions to guage the learners attention. There is also a quiz at the end. However, captivate includes on the questions throughout the course on the quiz results which I do not want to happen.
    Can anyone advise how I can only get certain questions appear on the quiz results please?

    Branch aware turns off the playbar in 6 (not in 7 any more, at least not for me).
    Could you explain more in detail what you want, because I don't understand it. You want the user to answer all questions, but the score should only show what? If you don't want some questions to have a score added to the Quiz total, you can indicate that in the Properties of that Question slide.
    And please, tell the exact number (3 versions of 6), and also if you have to report to a LMS?
    Lilybiri

  • How to get a question in the course placed anywhere in the course and does not appear in the quiz result or total number of questions. Pretest would work except it can't go anywhere in the course (at least for me it can't)

    How to get a question in the course placed anywhere in the course and does not appear in the quiz result or total number of questions. Pretest would work except it can't go anywhere in the course (at least for me it can't)

    Use a normal question, and do not add the score to the total score. That will give you a correct score at the end. But the total number of questions, that system variable will still take into account all questions. You'll need a user variable, and calculate its value by subtracting 1 from the system variable cpQuizInfoTotalQuestionsPerProject. Same for the progress indicator if you want to show it?
    Customized Progress Indicator - Captivate blog
    If you want to allow Review, you'll have to tweak as well. You didn't specify the version, and all those questions I now mentioned.
    And my approach, since you talk about only one question: create a custom question, because you'll have total control then.

  • How do I get the Questions to show in the 'View Responses' TAB, and then show up in the Summary Report?

    How do I get the Questions to show in the 'View Responses' TAB, and then show up in the Summary Report?

    There are more than one Applications folders. At the root level of your system is an Applications folder for all users, where most installations go. Every user, including you, also has a separat Applications folder.
    Check all of them.

  • Why can I no longer install iTunes updates on my computer? I keep getting messages saying it fails, and to do it manually, but then I get popups questioning whether I have the authority to make these changes. And it never updates.

    Why can I no longer install iTunes updates on my computer? I keep getting messages saying it fails, and to do it manually, but then I get popups questioning whether I have the authority to make these changes. And it never updates.

    Make sure you are running as the Administrator of the Account.
    Also...  See this User Tip by turingtest2
    Troubleshooting issues with iTunes for Windows updates

  • Hard disk in mums macbook failed, bought a new one, formatted it first. Have tried starting it with every possible key and I either get flashing question mark folder or a cursor.

    Hard disk in mums macbook failed, bought a new one, used sata adapter cable to format it for mac first. Connected it and have tried starting it with every possible key combination and I either get flashing question mark folder or a cursor. A disk is stuck in it so I can't boot from OSX, and yes I have tried every option of starting to try and eject disk but none work. HELP ME!

    Five ways to eject a stuck CD or DVD from the optical drive
    Ejecting the stuck disc can usually be done in one of the following ways:
      1. Restart the computer and after the chime press and hold down the
          left mouse button until the disc ejects.
      2. Press the Eject button on your keyboard.
      3. Click on the Eject button in the menubar.
      4. Press COMMAND-E.
      5. If none of the above work try this: Open the Terminal application in
          your Utilities folder. At the prompt enter or paste the following:
            /usr/bin/drutil eject
    If this fails then try this:
    Boot the computer into Single-user Mode. At the prompt enter the same command as used above. To restart the computer enter "reboot" at the prompt without quotes.
    If you have a 2010 MBP or later, then you can use Internet Recovery. Start by rebooting the computer. At the chime press and hold down the COMMAND-OPTION-R keys until a Globe appears in the upper part of the screen. This process can take upwards of 15 minutes to get connected to the Apple network servers. You should eventually see the utility screen of the Recovery HD. You may now go about the process to install Mountain Lion:
    Install Lion/Mountain Lion on a New HDD/SDD
    Be sure you backup your files to an external drive or second internal drive because the following procedure will remove everything from the hard drive.
    Boot to the Internet Recovery HD:
    Restart the computer and after the chime press and hold down the COMMAND-OPTION- R keys until a globe appears on the screen. Wait patiently - 15-20 minutes - until the Recovery main menu appears.
    Partition and Format the hard drive:
    1. Select Disk Utility from the main menu and click on the Continue button.
    2. After DU loads select your external hard drive (this is the entry with the mfgr.'s ID and size) from the left side list. Click on the Partition tab in the DU main window.
    3. Under the Volume Scheme heading set the number of partitions from the drop down menu to one. Click on the Options button, set the partition scheme to GUID then click on the OK button. Set the format type to Mac OS Extended (Journaled.) Click on the Partition button and wait until the process has completed. Quit DU and return to the main menu.
    Reinstall Lion/Mountain Lion: Select Reinstall Lion/Mountain Lion and click on the Install button. Be sure to select the correct drive to use if you have more than one.
    Note: You will need an active Internet connection. I suggest using Ethernet if possible because it is three times faster than wireless.

  • What can i do to get security questions back if i forgot my backup mail

    what can i do to get security questions back if i forgot my backup mail
    i had a little trouble with my apple id i bougth a gift card to itunes and would buy somthinigs   but something got wrong in the start when i maked the id  thinked that i could rember all of it but.. i couldnt i had a little trouble i forgot the recover email and the security questions so i was f*** i didnt know what to do and i thougth that you guys could help me please
    From dr_arthur

    The Three Best Alternatives for Security Questions and Rescue Mail
        1. Use Apple's Express Lane.
              Go to https://expresslane.apple.com ; click 'See all products and services' at the
              bottom of the page. In the next page click 'More Products and Services, then
              'Apple ID'. In the next page select 'Other Apple ID Topics' then 'Forgotten Apple
              ID security questions' and click 'Continue'. Please be patient waiting for the return
              phone call. It will come in time depending on how heavily the servers are being hit.
         2.  Call Apple Support in your country: Customer Service: Contact Apple support.
         3.  Rescue email address and how to reset Apple ID security questions.
    A substitute for using the security questions is to use 2-step verification:
    Two-step verification FAQ Get answers to frequently asked questions about two-step verification for Apple ID.

  • How Can I get Interview Questions and answers for Oracle9i DBA and PL/SQL

    How Can I get Interview Questions and answers for Oracle9i DBA and PL/SQL Programmer.

    Please check the following link.
    http://www.geekinterview.com/
    -aijaz

  • Banners are not displaying on a website. I get a question mark instead. Only since i updated to firefox 5 about ten minutes ago. Any ideas?

    I just updated my firefox browser to firefox 5. Since then a website that i am in the process of creating, has stopped displaying banners. Instead of the advert i was expecting i get a question mark in the top left corner.

    Adbock Plus is a Firefox extension, not part of Firefox, you don't have it.
    https://addons.mozilla.org/firefox/addon/adblock-plus/
    I see two banners and they are not blocked (they are legitimate)
    "The High Street for your Desk Top" and "It's Time to go shopping"
    I see the question mark now you refer to, in IE is see
    [Like] [f] 12 likes. Sign up to see what your friends like.
    Which is something to do with FaceBook. Appears in IE9, Google Chrome, Safari, all show the Facebook thing. Opera fails big time nothing but a repeated large button (>) with an arrow.
    Might be the CSS code.
    http://jigsaw.w3.org/css-validator/validator?uri=http%3A%2F%2Fwww.jems-shopping.co.uk%2F
    also on their links test, a bad link
    404 Not Found -- Line: 21 http://www.jems-shopping.co.uk/communities/6/004/008/841/836/images/4519752934.gif

  • Where can I get my questions about JMX answered?

    Where can I get my questions about JMX answered?
    In the Jungle Mix of the World Wild Web, where are the dwellings of the JMX denizens?
    It recently came to my attention that the answer to that simple question may not be obvious...
    I hope the information provided there
    [ http://blogs.sun.com/roller/page/jmxetc#where_can_i_get_my ] will be helpful.
    Cheers,
    -- daniel

    See this page
    http://java.sun.com/products/JavaManagement/community/forum.html
    Bye for now
    CSJakharia

  • Can't play quicktime trailers, keep getting a question mark?

    My mac started acting very strange 2 days ago. I can't play any trailers, the box opens and instead of the trailer playing, I get a question mark. this never happened. Please help

    I dont know if its aloud to talk about modding quicktime but this worked for me.
    1) Duplicate your quicktime and call the copy "Quicktime_Backup" (in case something goes wrong or when a new update comes out).
    2) On the original file, right click, show content and navigate to "Content/Resources/"
    3) delete all language-folders except the english one (example: Dutch.Iproj).
    4) restart Quicktime and safari, and you will be able to watch the HD trailers now.
    Note: Movies like the Small, Medium and large still wont play but then you maybe need to do the same with safari so you can play the movies within safari but im not sure about that.

  • After making a movie and wanting to burn a DVD, I go for iDVD in the 'DEEL'  menu. Then I get the question ' where is iDVD? What is the problem?

    After making a movie and wanting to burn a DVD, I go for iDVD in the 'DEEL'  menu. After couple of seconds I get the question ' where is iDVD?
    What is the problem? I cannot find iDVD in the programs map.
    regards Tonl

    The current Apple thinking is that the entire world has access to fast broadband and wants to distribute home movies to friends and relatives via download (iCloud) rather than mailing them a DVD. The fact that nothing could be further from the truth has so far had no effect on this policy. If you scream and shout loudly enough down the phone Apple may send you a free copy of iDVD. That worked for some, but is now said to have been withdrawn by Apple. Also, you can complain bitterly here, perhaps suggesting that Apple could have provided a choice between using iCloud and burning DVDs:
    http://www.apple.com/feedback/
    Whilst Macs with a Superdrive continue to be able to burn video DVDs, the software for so doing, iDVD, is no longer included in the iLife bundle that comes with OS 10.7 Lion (which also omitted iWeb) or will come with OS 10.8 Mountain Lion. And it is no longer included in the iLife 11 from the online Apple Store: http://www.apple.com/ilife/. Your only solution is to look on Amazon or eBay and try to get an older version that includes iDVD.
    However, the vastly more expensive FCPX can burn a DVD without iDVD or DVD Studio Pro involvement, but lack the themes etc of iDVD.

  • I keep getting blue question marks in my email

    I keep getting blue question marks in my e mails

    The message may be talking about icloud storage -or- available memory on your device.
    Go to Settings>General>Usage to see how much "Storage" you have available.  Farther down the list is the available storage on iCloud.
    Also check:
    Go to Settings>iCloud>Storage & Backups>Manage Storage; there, tap the device you need info on and the resulting screen lists Backup Options with which apps store data on iCloud.
    A device needs many MB of storage in order to perform a backup to iCloud.
    Also see:  http://support.apple.com/kb/ht4847

  • Get-ADGroupMember runing issue

    Hi guys
    I am just trying some basic AD scripts, but got some problem with Get-ADGroupMember
    I am trying to get a list of users in a group, including every subgroup in that group. Then I want to display samaccountname, Full Name and group they are in.
    Tried to run some basic command 
    import-module activedirectory
    Get-ADGroupMember "Domain Admins" -recursive | Select-Object Name,samaccountname
    When executed, I get this:
    Get-AdGroupMember : A parameter cannot be found that matches parameter name 'recursive'.
    At E:\scripts\testAD.ps1:2 char:35
    + Get-ADGroupMember "Domain Admins" -recursive | Select-Object Name,samaccountname
    +                                  
    ~~~~~~~~
        + CategoryInfo          : InvalidArgument: (:) [Get-AdGroupMember], ParameterBindingException
        + FullyQualifiedErrorId : NamedParameterNotFound,Get-AdGroupMember
    How do I get it to work? Using PS 3

    Hi,
    I'm not getting the error you do, but you can try the Quest AD powershell module.
    http://www.quest.com/powershell/activeroles-server.aspx
    if((get-pssnapin "Quest.ActiveRoles.ADManagement" -erroraction SilentlyContinue) -eq $null)
      {add-pssnapin "Quest.ActiveRoles.ADManagement"}
    Get-qadgroupmember "domain admins" -indirect | select-object name,samaccountname
    Hope this helps.
    Regards,
    Calin

Maybe you are looking for

  • Error in creating XML photo gallery with Flash CS4 and AS 3.0

    Hello, all. I've been creating an XML photo gallery with Flash CS4 and AS 3.0 following a tutorial. I followed the instructions step-by-step but at the end I got the following error message instead: Error #2044: Unhandled IOErrorEvent:. text=Error #2

  • Error in third party sales

    Dear Raja, Thanks for  give me good solution in third party sales, But it was half is done. What you told is Key-in Country Code: IN, and "Exter" Key-in Tax Code: VN, and "Enter" At Top, Click Tab: Tax Accounts. Key-in Charts of Accounts. Give the G/

  • I-Book not opening on my PC

    I am unable to view a book on my PC that I purchased recently from the Apple Store.  The book is in .epub format and was loaded into I-Tunes, but I am unable to open and read the book.   Is there a way to read an I-Book on my P.C.?

  • I can't rename a Workstation.

    Environment: NW 6.5, Zfd 4, eDir 8734 I'm trying to rename an imported workstation from: SY13-01-SITEA - XX:XX:XX:XX:XX:XXWIN2000 to: SY13A-01-SITEA - XX:XX:XX:XX:XX:XXWIN2000 and I keep getting the following error: Invalid Character(s) in Object nam

  • Interested in finding out about using LabView in Networking Testing applications.

    Networking Testing applications, such as: - General Ethernet and POS testing - BERT - RFC2544 back to back, Frame loss, Throughput - RFC2285 - IP Multicast - QoS - Load Balancing - Wireless IP - BGP - Other Networking testing