Tech Tip of the Week: Windows Powershell CMDlets

This week’s tech tip is for all you Windows PowerShell users.If you’re using PowerShell,  you may already know about CMDlets. If not, this post is sure to excite you, as CMDlets (pronounced “command-let”) are nifty commands that will ease the process of using
Powershell. 
Here are 5 CMDlets to get you started:
1. Get-Recipient | Where {$_.EmailAddresses –match “[email protected]”}
This CMDlet will find an email address that is inside of the quotes.
2. (Get-Mailbox) | ForEach {Set-Mailbox $_.Identity –RetentionPolicy “Contoso-Policy”}
This CMDlet applies a single retention policy to all users.
3. Get-MSOLUser | Set-MSOLUser –PasswordNeverExpires $true
This sets all users passwords to never expire (Requires Azure Module)
4. (Get-Recipient) | ForEach {Add-RecipientPermission –identity $_.PrimarySMTPAddress –trustee [email protected] –AccessRights SendAs –Confirm:$Y}
This gives a single mailbox SendAs rights to all other recipients (groups, mailboxes, external contacts).
5. (Get-Mailbox) | ForEach {Enable-Mailbox –identity $_.PrimarySMTPAddress –Archive}
This CMdlet turns on archiving for all mailboxes
Try out these CMDlets and let us know what you think!

This week’s tech tip is for all you Windows PowerShell users.If you’re using PowerShell,  you may already know about CMDlets. If not, this post is sure to excite you, as CMDlets (pronounced “command-let”) are nifty commands that will ease the process of using
Powershell. 
Here are 5 CMDlets to get you started:
1. Get-Recipient | Where {$_.EmailAddresses –match “[email protected]”}
This CMDlet will find an email address that is inside of the quotes.
2. (Get-Mailbox) | ForEach {Set-Mailbox $_.Identity –RetentionPolicy “Contoso-Policy”}
This CMDlet applies a single retention policy to all users.
3. Get-MSOLUser | Set-MSOLUser –PasswordNeverExpires $true
This sets all users passwords to never expire (Requires Azure Module)
4. (Get-Recipient) | ForEach {Add-RecipientPermission –identity $_.PrimarySMTPAddress –trustee [email protected] –AccessRights SendAs –Confirm:$Y}
This gives a single mailbox SendAs rights to all other recipients (groups, mailboxes, external contacts).
5. (Get-Mailbox) | ForEach {Enable-Mailbox –identity $_.PrimarySMTPAddress –Archive}
This CMdlet turns on archiving for all mailboxes
Try out these CMDlets and let us know what you think!

Similar Messages

  • Tech Tip of the Week: Syncing Distribution Groups in Office 365

    Having trouble getting your distribution groups to sync when migrating to Office 365?
    We recently worked with a customer who had over 300 distribution groups that were not syncing to Office 365. Upon review, we noticed that the distribution groups did not have a Display Name.
    Here are the steps we took in order to resolve the problem:
    1. Open ADUC “Active Directory Users and Computers “On the top menu click on view and select Advanced Features.
    2. Find the Distribution List that is not syncing to your Office 365 tenant > right click the Distribution List > select Properties > click on the attribute editor tab.
    3. There are a couple attributes that must be filled out in order  for it to Synchronize to Office 365.
    Attributes: mail,
    displayName – if they do not have any data, fill it in. Once completed click ok.
    4. Open the MIISClient. This is located on your DIRSYNC Server. The default path is: “C:\Program Files\Microsoft Online Directory Sync\SYNCBUS\Synchronization Service\UIShell\miisclient.exe”
    5. Click on Metaverse Search > input the following:
    Attribute: Mail
    Operator: Contains
    Value: 
    “Email Address of the DG”
    6. Once filled in click on search > double click the search results > click on the connectors tab. Note: If
    you only see SourceAD Management Agent, perform the following:
    7. Click on Management Agents > Right click SourceAD > click on Run > click on Full Import Stage Only > click on ok.
    8. Right click SourceAD > click on run > click on Full Sync > click on ok.
    9. Right click TargetWebService > click on Run > click on Full Confirming Import Stage > click on ok.
    10. Right click TargetWebService > click on Run > click on Full Confirming Sync > click on ok.
    11. Right click TargetWebService > click on Run > click on Export > click on ok.
    We hope you found this week’s Tech Tip useful! Do you have a problem you want us to solve in our Tech Tip of the week series? Let us know!

    Check to see that your remote session is still active, using Get-PSSession.

  • Apple's Tip of the week - Two Seconds to Sleep anomaly

    Apple states in its tip of the week
    "Tip of the Week
    Two Seconds to Sleep
    Want the fastest way to put your Mac right into a deep, sleepy-bear hibernation-like sleep (no whirling fan, no dialogs, no sound — nuthin’ — just fast, glorious sleep). Just press Command-Option and then hold the Eject button for about 2 seconds and Zzzzzzzzzzzzzz. It doesn’t get much faster than that."
    at URL http://www.apple.com/pro/tips/quicksleep.html
    I tried this on my 2x 2.5 GHz PowerMac G5 and it gave my computer fits.
    First it took 5 seconds to goto sleep and then immediately wakes up again. Not only this but it corrupted my Safari in as much as clicking on any web link would cause a download of the HTML and then after deleting the downloaded file and quitting the Safari download window all the Safari web pages being displayed or active in Dock would terminate and disappear. I had to restart the computer to regain some sanity. It was repeatable as well.
    If others experience a similar behavior I'd sure like to see some feedback as this is just too bad of Apple if its widespread.
    BTW - I'm running 10.4.7 (since it was released to public) and file system permissions are presitine and all correct just for the record.
    Thanks.

    I have been using this for a over a year (forget where I found it) and always use it to send my PowerBook to the Land of Nod, rather than just shutting the lid.
    When you do it this way, also, it is quite clear that some processes still need to do their thing, particularly a network; and also after using QuickTime (or video in iTunes).

  • Mac tip of the week 5/9/07: The smaller PDF Secret Control

    The tip of the week has instructions for compressing a PDF file. The compress PDF method mentioned first is fine, However, the instructions for making a filter to do this make no sense at all to me. It says to select Colorsync from the "second presets pop-up menu" when you open the print menu. What is this? Where is this "second presets pop-up menu?" When i open a print window, I get a print window. There's no pop up menu, first or second.
    For a Mac tip, this is surely obscure. Does anyone know what Apple is talking about here? Thanks
    -wayne

    For some reason when I select 'Add Filters' the dialogue closes and a .pdf is created.
    For some reason not working - any ideas as to why this happens?
    Thanks

  • Blank Tip of the day window

    Hi all,
    We have an odd happening in one of our video labs here at work.  When launching AE CS3 (ver 8 i believe?) the tip of the day window pops up after the program launches, but it's blank.  This happens on all but one of the machines in the lab.  Nothing had been installed lately - and oddly was working up until late last night.  I have been googling - searching this forum and only found one entry that was on the windows side and it was deemed an OS problem - i.e. no help
    Some info before I launch into my troubleshooting actions:
    all machines are the same
    Mac OS 10.6.8 ( we can't upgrade any further as the instructor doesn't wan't to teach the latest version of Final Cut)
    MacPro (4.1)
    Quad Core Intel Xeon 2.66 GHz
    6 GB ram
    OS Drive 500 GB drive
    Here's what I've done
    Re-installed the App hoping for a quick fix - no go
    Unistalled (deleting all prefs) and re-installed - no go
    Located an update and installed (8.02) - no go
    located user prefs and deleted - no go
    I'm at my wit's end and no relief seems to be in sight.  I know I can't be the only one that's experiencing this - Basically we can't use the program at all once that blank tip screen pops up - all menus are greyed out and even AE's help is greyed out as well.  We're forced to force quit the program to gain access to the machine again.
    Help!
    Thanks
    Joe

    Well, I work at a university - we don't have the budget to do the upgrade treadmil on all the software we try to support - we've got to work with what we have - I can see that I'm going to get no where with that type of attitude - no wonder why most universities are going to find alternatives to Adobe - just my 2 cents.  I asked a question - I didn't need to be berated by a company that we've pumped tens of thousands of dollars over the years just to say well, screw you

  • "Apple Quick Tip of the Week" podcast crashes AppleTV

    I have iTunes set to download the Apple Quick Tip Of The Week (AQTOTW) podcasts, and then sync them to my AppleTV. Nearly every one of the AQTOTW podcasts that I play causes the AppleTV video to stutter and eventually, the white Apple logo appears. After a few seconds, I am seeing the main menu.
    None of the other podcasts that I view on the AppleTV have this problem.
    The software on the AppleTV is up to date. iTunes runs on a Macmini which is running Leopard (up to date as well).
    The AQTOTW are very useful, how can I view them on the AppleTV?

    There are a number of good hints in this post, many of which apply in Leopard.

  • Quick tip of the week

    Hi All,
    Have you noticed that the "quick tip of the week" on the apple.com/business/videotips page are done on machines running tiger. A number of them including some of those most recently added (e.g. "When a pdf is too big", and "zip up your files") seem not to be applicable in Leopard. I find this a bit weird. Come on apple get up to speed with Leopard please.
    BTW anyone know how to shrink down the size of a pdf in Leopard?
    Thanks

    There are a number of good hints in this post, many of which apply in Leopard.

  • Tip of the Week Should be part of our standard toolkit of Answers.

    This OSX "Tip of the Week":
    http://www.apple.com/pro/tips/emailresize.html
    Should be in the standard Quiver of answers when people ask how to resize images. You can do it from within the mail app!
    krb

    Keith
    How cool is that!
    Regards
    TD

  • SQL Server 2012 Import-Module 'sqlps' breaks the "Test-Path" PowerShell cmdlet

    I've run into something that is "very" frustrating with the new SQL Server 2012 PowerShell module.  When I Import the module, it breaks the "Test-Path" cmdlet when trying to test a UNC path to a directory.
    For example:  
    "Test-Path -path \\server\dirname" returns true as expected before the sqlps module is imported.  But after you import the SQL Server module "Import-Module 'sqlps' –DisableNameChecking" the same Test-Path
    now returns false.
    If I run the following in Windows PowerShell ISE I see the following results:
    Test-Path -path "\\server\directoryname"
    Import-Module 'sqlps' –DisableNameChecking
    Test-Path -path "\\server\directoryname"
    True
    False
    Anyone have any idea what's going on?
    UPDATE: after more testing, it looks like the problem happens with any cmdlet that references a UNC.  The New-Item has the same problem.  Before importing 'sqlps', New-Item is able to create a directory at the UNC path specified, but ater importing
    'sqlps', the New-Item fails.
    Thanks!

    Hi Mikea730,
    Sqlps.exe doesn't take advantage of a couple of these nice PowerShell V2 cmdlets without doing a bit of configuring in your environment. 
    Please refer to the following references to make some configuration in your server
    http://www.maxtblog.com/2010/11/denali-get-your-sqlpsv2-module-set-to-go/
    http://www.simple-talk.com/sql/database-administration/practical-powershell-for-sql-server-developers-and-dbas-%E2%80%93-part-1/
    http://sev17.com/2010/07/making-a-sqlps-module/
    Thanks,
    TechNet Subscriber Support
    If you are
    TechNet Subscription user and have any feedback on our support quality, please send your feedback
    here.
    Iric Wen
    TechNet Community Support

  • It is there an alternative to the Test-SystemHealth powershell cmdlet for Exchange 2013?

    Hello
    The Powershell cmdlet Test-SystemHealth, that was available on Exchange 2010, is no longer available on Exchange 2013.
    Test-SystemHealth cmdlet gathered data about the Microsoft Exchange system and analyzed the data according to best practices.
    Are there any alternatives to this for Exchange 2013?
    Thanks!

    Haven't really played with it too much, but check out Get-ServerHealth
    http://technet.microsoft.com/en-us/library/jj218703(v=exchg.150).aspx
    Looks to have replaced Test-SystemHealth.

  • ICal missing the Week window

    My iCal is acting strange. The daily and monthly views are functioning, but the weekly view isn't showing at all.
    For a brief moment i managed to get the weekly view, but it did not react at all to mouse clicks or anything. There was also a weird 10 cm horizontal line situated some 15 cm down left of the window. I then tried quitting iCal, but it did not allow me to do it and there wasn't even a force quit option there, just the usual quit. Then i tried rebooting: a text saying "iCal prevented you from rebooting the computer". Same when I tried shutting down. I had to force shutdown.
    After rebooting, the iCal still works strangely. No weekly view whatsoever. Strange and annoying.
    iMac G5 20" 2,1 Ghz (rev. C)   Mac OS X (10.4.4)   actually 10.4.5.

    Solved. I removed all the files with iCal on their name from the user/preferences/ -folder and all files from user/library/application support/syncservice -folder.

  • Quick Tip of the Week: Take a Quick Look at the files in Trash

    I ran this Quick Tip which was emailed to me today, but noticed that the Quick Look icon demonstrated isn't on my Toolbar, instead there's something called a Path icon, and Finder>View>Customise Toolbar is greyed out, so I do not appear to be able to change it. Quick Look works when I press the space bar, so it is on my iMac.
    Does anybody know why Quick Look isn't on the Toolbar, and how to change the Path icon for Quick Look?

    To open a Finder window, click a clear space on your Desktop. You'll see the word Finder top left in your screen. You can press command Command N on your keyboard or use your mouse and from the Menu Bar (top of screen) click File/New Finder Window.
    Migration Assistant will transfer all your files and important settings for you.
    To see exactly which Mac OS version you are running, click the Apple logo top left in your screen, then click, "About This Mac". The version number will be displayed in that pane.
    Carolyn

  • Tip of the week: How to get started with the Admin Console

    Good e-discovery practices are becoming a higher priority for companies everywhere. With the proliferation of cloud services, social networks, and mobile devices used by employees, electronically stored information (ESI) lives in more places than ever before. Add to that the growing threat of data breaches, and you have a real need for industry leaders who can share their best practices.RecentlyGuidance Softwareconducted its annual e-discovery survey, and they’re holding a webinar in which leading security and e-discovery experts will weigh in on the survey’s findings. On the survey panel is Dropbox Head of Trust and Security Patrick Heim, formerly chief trust officer at Salesforce, and CISO at Kaiser Permanente and McKesson. He’ll be joined by Scott A. Carlson of law firm Seyfarth Shaw, Chris Dale of the eDisclosure Information...
    This topic first appeared in the Spiceworks Community

    awesome, thank you!

  • Cisco IPS Tech Tips: 2010 Dec. 16 - Show Tech Part 1 Recording

    Hi Cisco IPS Users,
    I've attached the recording from our last Tech Tips regarding the "show tech" command. We hope that you will find this of value in the operation of your Cisco IPS.
    As always feel free to leave comments on the content or future subjects you would like to see us address.
    The continuation of this discussion will take place today (Jan 27th).
    Thanks,
    -Robert
    Robert Albach
    IPS Product Management
    [email protected]

    The recordings and the presentation slides are placed here on the Cisco Support Community. I think if you roll the threads back some you will see the prior month's Tech Tips (then called Tech Talks) posted.
    This one will be posted a few days after the event.
    -Robert

  • [Forum FAQ] How to find and replace text strings in the shapes in Excel using Windows PowerShell

    Windows PowerShell is a powerful command tool and we can use it for management and operations. In this article we introduce the detailed steps to use Windows PowerShell to find and replace test string in the
    shapes in Excel Object.
    Since the Excel.Application
    is available for representing the entire Microsoft Excel application, we can invoke the relevant Properties and Methods to help us to
    interact with Excel document.
    The figure below is an excel file:
    Figure 1.
    You can use the PowerShell script below to list the text in the shapes and replace the text string to “text”:
    $text = “text1”,”text2”,”text3”,”text3”
    $Excel 
    = New-Object -ComObject Excel.Application
    $Excel.visible = $true
    $Workbook 
    = $Excel.workbooks.open("d:\shape.xlsx")      
    #Open the excel file
    $Worksheet 
    = $Workbook.Worksheets.Item("shapes")       
    #Open the worksheet named "shapes"
    $shape = $Worksheet.Shapes      
    # Get all the shapes
    $i=0      
    # This number is used to replace the text in sequence as the variable “$text”
    Foreach ($sh in $shape){
    $sh.TextFrame.Characters().text  
    # Get the textbox in the shape
    $sh.TextFrame.Characters().text = 
    $text[$i++]       
    #Change the value of the textbox in the shape one by one
    $WorkBook.Save()              
    #Save workbook in excel
    $WorkBook.Close()             
    #Close workbook in excel
    [void]$excel.quit()           
    #Quit Excel
    Before invoking the methods and properties, we can use the cmdlet “Get-Member” to list the available methods.
    Besides, we can also find the documents about these methods and properties in MSDN:
    Workbook.Worksheets Property (Excel):
    http://msdn.microsoft.com/en-us/library/office/ff835542(v=office.15).aspx
    Worksheet.Shapes Property:
    http://msdn.microsoft.com/en-us/library/office/ff821817(v=office.15).aspx
    Shape.TextFrame Property:
    http://msdn.microsoft.com/en-us/library/office/ff839162(v=office.15).aspx
    TextFrame.Characters Method (Excel):
    http://msdn.microsoft.com/en-us/library/office/ff195027(v=office.15).aspx
    Characters.Text Property (Excel):
    http://msdn.microsoft.com/en-us/library/office/ff838596(v=office.15).aspx
    After running the script above, we can see the changes in the figure below:
    Figure 2.
    Please click to vote if the post helps you. This can be beneficial to other community members reading the thread.

    Thank you for the information, but does this thread really need to be stuck to the top of the forum?
    If there must be a sticky, I'd rather see a link to a page on the wiki that has links to all of these ForumFAQ posts.
    EDIT: I see this is no longer stuck to the top of the forum, thank you.
    Don't retire TechNet! -
    (Don't give up yet - 13,085+ strong and growing)

Maybe you are looking for

  • Upgrade Oracle 10g database 10.2.0.1 to 10.2.0.2

    I have downloaded the trial version of 10g application server and 10g oracle database from Oracle site. But when I tried installed the 10g application server which needs to connect to the 10g database, I got the following error. Database version shou

  • When i run itunes in iphone 5 - it show "cannot connect iTunes store "

    when i run iTunes and Music in our new iphone 5 - it show same message "Cannot connenct to iTunes Store". pls help us.

  • XMLDocument print (no indent)

    Hallo, I need to print out the content of an XMLDocument in a String in a "flat" mode (without spaces or CRLF between tags). The method print() in XMLDocument seems the simplest way to print out... but it produces a formatted output (with spaces or C

  • I can't find a song I bought on itunes?

    I bought a sobng on itunes, and when it showed up on my song list it had a picture of a cloud near it. Now, I can't find the song on my itunes list but I paid for it. Help?

  • I can't open my Elements 12 download

    I have a new laptop and want to transfer my Elements 12 over. After searching the site longer then i should have to, i found a link to download Elements 12. But when i go to run the file it ask me what to open it with. It is a 7Z Compressed Achieve f