Remove various accepted domains (exchange 2007) from a list file via powershell

hello!
i'm a newbie with powershell and i'm trying to find if is it possible to remove a lot of exchange 2007 accepted domains from a csv file using powershell.
I want to delete accepted domains contained in a csv, it has only domains name and powershell requires the name , that is different from the domain.
example of accepted domain in my organization:
Name                           DomainName                DomainType            Default
Domain0001        
domain1.com     Authoritative         False 
Domain0002 hello1.com
Authoritative False
I've only a csv with domains name:
domain.csv:
Domain
domain1.com
hello1.com
Deleting an accepted domain via powershell requires the name so I need to extract first the name of , i've tried with this command and it works:
Get-AcceptedDomain | Where{$_.DomainName -eq 'domain1.com'}
This works only for 1 domain, I've a lot of domains to delete so it's inviable
Now, i'm trying to launch this command without success:
import-csv domain.csv | foreach {Get-AcceptedDomain | Where{$_.DomainName -eq '$_.Domain'}}
Probably there is a syntax error, or maybe I just can't do it. 
Any help? 
Many thanks in advance!!

Don't know what to tell you, then.  If I create a test file with that data, the Import-CSV works for me:
Domain
3414257440.domain.com
domain1.domain.com
'@ | set-content c:\testfiles\domain.csv
$DomainNames =
Import-CSV 'c:\testfiles\domain.csv' |
Select -ExpandProperty Domain
$DomainNames
3414257440.domain.com
domain1.domain.com
[string](0..33|%{[char][int](46+("686552495351636652556262185355647068516270555358646562655775 0645570").substring(($_*2),2))})-replace " "

Similar Messages

  • Exchange 2007 cannot export pst files via its powershell

    Hi,
    I am trying to export pst files from Exchange server 2007.
    This script used to work perfectly.
    Export-Mailbox -Identity paddy -PSTFolderpath C:\pst\
    But now I am getting an error message saying this
    Export-Mailbox : The specified mailbox database "SRV03\First Storage Group\Mail
    box Database" does not exist.
    At line:1 char:15
    + Export-Mailbox  <<<< -identity paddy -PSTFolderPath C:\pst\
    MoveType                         : ExportToPST
    MoveStage                        : Initialization
    StartTime                        : 01/01/0001 12:00:00 AM
    EndTime                          : 01/01/0001 12:00:00 AM
    StatusCode                       : -2147467259
    StatusMessage                    : The specified mailbox database "SRV03\First
                                       Storage Group\Mailbox Database" does not exi
                                       st.
    ReportFile                       : C:\Program Files\Microsoft\Exchange Server\L
                                       ogging\MigrationLogs\export-Mailbox20140527-
                                       155543-8040336.xml
    what would be the problem?
    I checked that the account has full permission so permission would not be the issue.
    Thanks

    Hi,
    First, please check if the mailbox database mentioned in the error message is mounted.
    Besides, please check if you can export other mailbox using the Export-Mailbox cmdlet.
    If all mailbox are affected, please check if you have the Exchange Server Administrator role assigned.
    1. Open EMC.
    2. Select the Organization Configuration node from the console tree.
    3. Please check the permissions assigned in the result pane. If there is no the Exchange Server Administrator role, please add it to check the result.
    Best regards,
    Belinda
    Belinda Ma
    TechNet Community Support

  • Removing Exchange 2007 from SBS 2008 (In an Exchange 2010 Coexistance Scenario) - In order to remove 2007 Mailbox Objects from Active Directory and remove the SBS2008 server completely

    I'm trying to remove Exchange 2007 from an SBS 2008 server
    (Server 2008 Standard FE).  My ultimate goal is to completely remove the SBS 2008 Server from the network environment.
    We have an Exchange 2010 Coexistence Scenario and Mailboxes/Public Folders/etc have been moved over to the 2010 mail server, on Server 2008 R2.
    I have moved all Shares, FSMO roles, DHCP, DNS, etc over to their respective servers.  We have two full blown DC's in the environment.
    I'm ready to remove Exchange 2007 from SBS 2008 and DCPROMO the server.  I can NOT seem to find a TechNet article that shows me how
    to proceed in this kind of scenario.  I am trying to use the TechNet article:
    http://technet.microsoft.com/en-us/library/dd728003(v=ws.10).aspx
    This article references Disabling Mailboxes, Removing OAB, Removing Public Folder Databases, then uninstalling Exchange using the Setup Wizard. 
    When I go to Disable Mailboxes I get the following error:
    Microsoft Exchange Error
    Action 'Disable' could not be performed on object 'Username (edited)'.
    Username (edited)
    Failed
    Error:
    Object cannot be saved because its ExchangeVersion property is 0.10 (14.0.100.0), which is not supported by the current version 0.1 (8.0.535.0). You will need a later version of Exchange.
    OK
    I really don't see why I need to Disable Mailboxes, Remove OAB and Public Folder Databases since they have been moved to 2010.  I just want
    to remove Exchange 2007 and DCPROMO this server (actually I just want to remove any lingering Exchange AD Objects referring to the SBS 2008 Server, using the easiest and cleanest method possible).
    Can someone point me in the right direction?
    Thanks!

    Hi,
    Based on your description, it seems that you are in a migration process (migrate SBS 2008 to Windows Server
    2008 R2). Now, you want to remove Exchange Server and demote server. If anything I misunderstand, please don’t hesitate to let me know.
    On current situation, please refer to following articles and check if can help you.
    Transition
    from Small Business Server to Standard Windows Server
    Removing SBS 2008 –
    Step 1: Exchange 2007
    Removing SBS 2008 – Step 2:
    ADCS
    Removing
    SBS 2008 – Step 3: remove from domain / DCPROMO
    Please Note: Since the web site is not hosted by Microsoft, the link may change without notice. Microsoft
    does not guarantee the accuracy of this information.
    Hope this helps.
    Best regards,
    Justin Gu

  • Remove Exchange 2007 from an Exchange 2013 coexistence.

    Hey everyone,
    I've just installed Exchange 2013 on a new server and all is working great.  It is currently in coexistence with our old Exchange 2007 server.  I've since shut the server down and Exchange 2013 has been working without issue.  However, I haven't
    been able to find any articles on this matter so I figured I would ask the question here.
    How do you remove Exchange 2007 from the coexistence.  Do I just uninstall Exchange 2007 from the old server and it will remove itself from the server and the domain?  Any help/link on this matter would be greatly appreciated.
    Thank you,
    Chris

    Hi Simon,
    I am about to do the same exercise as Chris,  I just would like some clarity.  
    1) When you say mailbox Database, do you mean make sure there are no more mailboxes that you want to move over, or are you actually meaning delete the physical DB on the exchange 2007 server.
    2) If there is no use of public folders does anything need to happen?
    Thanks,
    Terry

  • Removing non printable characters from an excel file using powershell

    Hello,
    anyone know how to remove non printable characters from an excel file using powershell?
    thanks,
    jose.

    To add - Excel is a binary file.  It cannot be managed via external methods easily.  You can write a macro that can do this.  Post in the Excel forum and explain what you are seeing and get the MVPs there to show you how to use the macro facility
    to edit cells.  Outside of cell text "unprintable" characters are a normal part of Excel.
    ¯\_(ツ)_/¯

  • Creation of a shipping notification for a PO in EBP from a XML file via XI.

    Hi everybody.
    We are trying to create a shipping notification for a Purchase Order in Enterprise Buyer from a XML file via XI.
    For to do it, we are using ‘DespatchedDeliveryNotification_In’ message interface (transaction SPROXY).
    But when we execute it, the system show us next message:
    "An error occured within an XI interface: An exception with the type CX_GDT_CONVERSION occurred, but was neither handled locally, nor declared in a RAISING clause Programm: SAPLBBP_BD_MAPPING_SAPXML1; Include: LBBP_BD_MAPPING_SAPXML1F5B; Line: 4"
    No more information is available.
    Is there any additional transaction to see more information about the error message?
    Is there any documentation about this XML file, mandatory fields, examples…?
    We populated some fields in our XML file, but we do not know if the problem is with mandatory fields, data, program error…
    I will thank for any information
    Thanks in advance.
    Raúl Moncada.

    Raúl,
    This is because of the inbound UOM.
    The include LBBP_BD_MAPPING_SAPXML1F5B is in charge of mapping the item Unit Of Mesure (UOM) sent in the ASN XML file (it should be an ISO code).
    You can test FM UNIT_OF_MEASURE_ISO_TO_SAP with this inbound ISO code.
    PS: you should create an OSS message so the mapping sends back an error message instead of generating an uncatched exception (that generates a dump).
    Rgds
    Christophe
    PS: please reward points for helpfull answers

  • Remove and reconnect Exchange 2007 from Domain

    I have an Exchange 2007 server running on a Windows 2008 server. For some reason the server will not run group policies. It hangs for a very long time when logging in on "Applying Group Policy Printers Policy" And also won't shutdown hanging on
    "Applying Group Policy". The only wany I can shut it down is to manually power off the server.
    I also ran the Group Policy Results Wizard and get a timeout when I run it against the Exchange server. DNS is working fine. I have tested all of the other servers using the same DNS and they all work fine. The server in question has been having other problems
    for a while now, but I have been able to resolve all the other problems except for this one. The server is old and will be replaced this year, but I have to make it work until I get a new server. Maybe 6 months or so.
    I am thinking of removing the server from the domain and then joining the domain again. I'm not sure that will fix it, but I hope it will. The only thing I'm worried about is getting the Exchange database and server running again after I remove and rejoin
    it to the domain. I have heard I can shutdown and disable all Exchange services, then remove the server from the domain and rejoin. But I have never done that and want to be sure it can be done without destroying connectivity to AD and the users. So, is this
    possible?
    Any help is appreciated.
    Doug

    You should try fixing the AD issues instead of removing the Exchange server from the domain. You should start by analyzing what was done to cause the issue in the first place and remedy that.
    Here is a bit similar concern that has been discussed earlier and has been suggested some good steps to sort-out the issue :
    http://community.spiceworks.com/topic/267400-removing-and-re-joining-an-e2k7-server-to-the-domain
    Moreover, when need to recover mailbox items back into previous format, you may also give shot to this automated solution (http://www.exchangeserverrecovery.com/) that could be a good approach while dealing
    in such crucial circumstance.

  • Remove Exchange 2007 from AD (manually)

    In the lab I had Exchange 2007 running and someone pulled my VM.  It's not the end of the world because I'm done with what I was doing in 2007 however I've got other things running in the lab and I'd rather not rebuild the domain.
    Does anyone know what the process would be to clean up AD (remove the Exchange org) without having the Exchange server to do an uninstall on?  Can I Install the Exchange admin console on another box and than remove the mail attributes from the accounts that has them and just remove the Exchange Systems Object container in AD or is there more?
    Erik

    I did run into one problem while trying to install RTM:
    Organization Preparation
    Failed
    Error:
    The well-known object entry B:32:A7D2016C83F003458132789EEB127B84:CN=Exchange Servers\0ADEL:e60b372e-cd97-4fc2-bc8f-907728f0bc8d,CN=Deleted Objects,DC=domain,DC=com of the otherWellKnownObjects attribute on container object CN=Configuration,DC=domain,DC=com
    points to an invalid DN or a deleted object.  Please remove the entry and rerun the task.
    I was able to resolve the issue by launching adsiedit.msc (part of the support tools) and going to the Configuration partion and bringng up the properties for Configuration,DC=domain,DC=com
    I edited the "othereWellKnownObjects" attribute to be "not set" (which it should be) by leaving it blank and clicking "add" (adding nothing) than applying the changes and re-running setup.
    Kudos to this thread for the fix:
    http://forums.microsoft.com/TechNet/ShowPost.aspx?PostID=839779&SiteID=17
    Cheers,
    Erik
    otherWellKnownObjects is a multi-valued object.  You need to remove the bad value, NOT ALL OF THEM!!
    Mike Crowley | MVP
    My Blog --
    Planet Technologies

  • Removing Exchange 2007 from SBS 2008 after Migrating to Office 365 Mid Sized with DirSync and SSO

    We have recently completed off a Migration of Exchange 2007 to Office 365 Mid Sized platform.
    I now need to decomission the old SBS 2008 server as they have moved to a Windows Server 2012 R2 server setup for DC, File and print and application servers.
    I need to know what are the ramifications of removing the Exchange 2007 server from the SBS 2008 server and will this remove the LegacyDN details from AD and cause any issues with internal emails between users using Outlook linked through to Office365.
    I understand that after removing Exchange 2007 there will be no friendly GUI to update and maintain proxyAddress, targetAddress and LegacyDN addresses, I am comfortable doing this in ADSI edit or with a script.
    Will this remove the x500 addresses relating to the on premise Exchange Orgainisation and just leave behind the x500 addresses for Exchange Labs which I assume is the x500 addresses for the Azure AD intergration for Office365.

    Hi ,
    Thank you for posting your issue in the forum.
    I am trying to involve someone familiar with this topic to further look at this issue. There might be some time delay. Appreciate your patience.
    Thank you for your understanding and support.
    Best Regards,
    Andy Qi
    Andy Qi
    TechNet Community Support

  • Is it possible to access the Public Folders in Exchange 2013 during a migration from Exchange 2007 to verify the files are there?

    This is a migration from Exchange 2007 to Exchange 2013.  We're in the middle of migrating the Public Folders.  Is it possible to configure a database to point to the Exchange 2013 public folders so I can verify the data before the final cut?
     If so what are the steps to do that?  Thanks in advance.

    To my knowledge no.  It's an all or nothing thing with public folders.
    Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread

  • How to upgrade Exchange 2007 from Sp1 to SP3 RU13

    Hi everyone, I have a mail system Exchange 2007 SP1 CAS and HUB with 3 servers. 
    The mailboxes are on a Windows Server 2008 Failover Cluster. 
    Domain controllers are Windows Server 2003 SP2 
    I have to update the mail system with Service Pack 3 and RU13. 
    Does anyone can tell me the procedure? where I have to start by the CAS / HUB or cluster mailboxes? 
    How do I update the cluster of mailboxes, the resources on the active node and update it, or liability? 
    There's something I have to take intoaccount before upgrading? 
    I can upgrade directly to SP3? or I have to upgrade before SP2?  thank you very much
    Microsoft Certified IT Professional Server Administrator

    http://technet.microsoft.com/en-us/library/bb885043(v=exchg.80).aspx
    Applying Exchange 2007 Update Rollups to Clustered Mailbox Servers
    and
    http://technet.microsoft.com/en-us/library/ee221147(v=exchg.80).aspx
    How to Install the Latest Service Pack or Update Rollup for Exchange 2007
    and, yes, you can go straight to SP3
    Twitter!: Please Note: My Posts are provided “AS IS” without warranty of any kind, either expressed or implied.

  • How to import PST to Exchange 2007 from Exchange 2010

    Hello everyone,
    I have a problem with importing PSTs to Exchange 2007 mailboxes.
    I exported PSTs without problem on Exchange 2010 using New-MailboxExportRequest but I run in several problems with importing PSTs on Exchange 2007.
    I created VM with Windows XP, 32bit Exchange Management tools and Outlook 2007 because it's needed for importing/exporting in Ex2007 Envinroment. I created separate account for imporing PSTs, grant him rights to Exchange server and specific mailbox but I still
    got this error while importing: Error occurred in the step: Approving object. An unknown error has occurred., error code: -2147219968 or sometimes import run without any error but no messages are imported (also it is processed very fast).
    I use Import-Mailbox -identity <user> -PSTFolderPath <Path>
    Do you know what causing this issue and how to fix it or how to import PST to Exchange using different aproach?
    Thank you

    Hi,
    Please make sure that your account has proper permissions
    Exchange Server Administrators role
    Local Administrators group for the target server
    Full access to the target mailbox
    In addition. what’s size of that PST file? If it is too large, it might be corrupted and we may need to export it again from Exchange 2010.
    Best Regards.  
    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact [email protected]
    Lynn-Li
    TechNet Community Support

  • Uppgrading Exchange 2007 from sp1 to sp3 on small business server 2008 sp1

    Hello everyone
    I know this topic has been discused many time in this froum. but i have to ask it again in my exact situation. 
    I have a realy unstable and unsafe server which i am planing to migrate all the apps and services to some virtual servers soon.
    first migrating is Exchange. i have Exchange 2007 sp1 on my server sbs 2008. i have my DC,AD, dns, DHCP, File, etc on the same server as well . So that is way it is scary for me (as i am not really experienced) to even upgrade one service pack.
    Now, i want to know if anyone did it before. What should i expect during upgrading or after that? so i can be ready for that?
    which kind of backup can save me if somethings happens to my Exchange? is there any way to install the new Exchange 2007 and sp3 rollup 10 and then migrate all databases and mailboxes to that new server? if yes, how to do that?
    Thanks 
    Nima

    Hi Nima,
    Ok, I know your concern. Please make sure you have read the above KB I provided before installing SP3 for Exchange 2007. What's more, you need to make sure you right mouse click and run as admin to install it.
    Moreover, here is a thread about migrating Exchange 2007 SP3 to Exchange 2013 for your reference.
    Migrate SBS 2008 R2 running Exchange 2007 to Windows Server 2012 Exchange 2013
    http://social.technet.microsoft.com/Forums/en-US/4c9b96c2-fd5e-4fbe-8b3a-fb5b3ab29da8/migrate-sbs-2008-r2-running-exchange-2007-to-windows-server-2012-exchange-2013?forum=smallbusinessserver
    Hope it helps.
    Best regards,
    Amy Wang
    TechNet Community Support

  • Exchange 2007 Global Address List

    I connect to my organisations Exchange 2007 server.
    My address book syncs for my personal contacts, appearing in address book as a brown book icon with an @ symbol.
    However, there is also a blue book icon with an "i" on it. When I click on it, in the right hand pane appears "Search [organisation] global address list", but there are no entries.
    I can access the global address list either through Outlook Web Access (OWA) or Outlook (on a PC), so I know there are entries there. On OWA, my personal entries appear in Contacts, whereas the global address list appears on OWA in address book.
    Any tips on how to access the global address book from within Address Book on Mac?
    Thanks in advance.

    Further update, if I do a search whilst "Search [organisation] global address list" is displaying, it does search the global address list and bring up results from it.

  • Exchange 2007 - User getting 404 File or directory not found

    Exchange 2007 OWA 404 - File or directory not found. I have two database on the same server and this problem is only affecting one database and the user in the other database is fine.  I did a test and move the user to the other database and I gave
    myself  full access to the user mailbox and use OWA (Change mailbox) to access other user and later login as the user itself and everything is fine.  I have thousands of user, and doing this is time consuming.  Anythough on this?

    Hi Tony,
    According to the description, I notice that you have a problem on OWA. When logon OWA with users from specific database, get error "Exchange 2007 OWA 404 - File or directory not found".
    I suggest check following points.
    1. Please make sure OWA Virtual Directory in IIS is available.
    2. Please make sure the OWA Virtual Directory in IIS has configured Basic Authentication by default.
    3. Please try to re-build OWA VD for testing. I saw someone solved this issue by re-building OWA VD.
    4. Since you have tested, moving mailbox to another database can auto-fix this issue, please also try to follow Ed to solve this issue.
    Thanks
    Mavis Huang
    TechNet Community Support

Maybe you are looking for

  • How can I revert to previous Entourage prior to Microsoft office 2004 update

    I have a 2002 eMac  OS X 10.4.11 bought second hand 5 years ago. I have been successfully using Entourage for all my email. On Friday the system updates required(?) me to update Adobe Reader. Immediately afterwards there appeared an update for Micros

  • Import and Export settings and presets

    Thanks in advance. Where can I save all the different import and export settings? Like if I just want to export Quicktime with audio and save that setting so I don't have to reset it every time. Thanks

  • USB Port error on start up

    Last night suddenly i plug a mouse on usb port. Then something show on leftbelow on the screen, something that show error on USB  port. Then i try to restart my laptop. Is Presario C300EA. After the first screen bios it shows all boot working normal

  • Does SAP provide  visual funciton for configuration of business process  ?

    I mean ,take the defining the sales process for example, a company may have many types sales,the standard sales process, sales without delivery, sales with delivery by other companies so on and so forth. Can I have a visual configuration which makes

  • Unable to save a Z-Tcode in Custom Package,unable to assign a transport Req

    Hi all, I am trying to create a T-code for standard SAP Program RSTXPDFT4. I was able to successfully create a T-code for this report program which has selection screen. But I created it as a Local Object. Now I am trying to create another T-code for