exchange
91 TopicsSend-MailMessage with Powershell and Exchange Online with MFA
I am having difficulty with one of my scripts that blocks a user from signing into Office 365 then sends an email to my manager and HR when the script has completed. I downloaded the Exchange Online Powershell Module and connected to EXOPSSession but I receive an error message that I need a secure connection to send a message. I know I created a secure connection with the old way to connect with Exchange Online but not sure how to do it when I connect to EXOPSession. Can someone please point me in the right direction?84KViews0likes4CommentsExchange Online - Change primary email address, name and alias of a shared mailbox
Hi All, I have been asked by HR to change the email address, name and alias of a few shared mailboxes that were set up last year. For example, I need to change "jobs-mathssec@domain.com" into "jobs-maths@domain.com", and the name/alias consequently. I need to do the same for 9 other mailboxes which have "sec" in the email address. Is it safe to run the following command: set-mailbox jobs-mathssec@domain.com -EmailAddress "SMTP:jobs-maths@domain.com","smtp:jobs-maths@domain.onmicrosoft.com" -Name jobs-maths -DisplayName jobs-maths -Alias jobs-maths Will the old name stay in other properties? I would need to keep all the old emails sent to the old address. Thank you in advance for your help!Solved67KViews0likes5Commentsa Script for automatic answer 'Y' on powershell, no need user response
Hi All, I'm new to Powershell. I try to run this script Remove-DistributionGroupMember -Identity "group name" -member "email member" on Powershell. every time I run this script I will get a response to typing 'Y'. Is there any complete script so I don't need to type 'Y'? I've tried added Echo Y but it's not working. Thanks.Solved42KViews0likes6CommentsTask Scheduler to connect to Exchange Online Powershell using MFA
I need to schedule a task to run this script below. I am able to run the below script when I am logged on the server, however when I schedule this as a task to run as "Run whether the user is logged on or not", it fails. The script *********************************************************************** #To record the ps session Start-Transcript -path c:\temp\PSSession.txt # Import the Exchange Online module cd C:\Users\<username>\AppData\Local\Apps\2.0\<GUID>\<GUID>\micr..tion_c8rrr8aa06b0c4a9_0010.0000_48a5c30b19dd2125 Import-Module .\CreateExoPSSession.ps1 # Write output after the exchange online module imported Write-Output "Importing Module completed" #Connect to Exchange Online Connect-EXOPSSession -UserPrincipalName user@domain.com #Write an output when connected to exchange online Write-Output "Connecting to Exchange Online completed" #Exp Get-UMMailbox <username> | Export-Csv c:\temp\UM_Mailbox.csv " ************************************************************************ The error I see in the transcript file is; ------------------------------------------------------------------------- PS>TerminatingError(New-ExoPSSession): "Showing a modal dialog box or form when the application is not running in UserInteractive mode is not a valid operation. Specify the ServiceNotification or DefaultDesktopOnly style to display a notification from a service application." >> TerminatingError(New-ExoPSSession): "Showing a modal dialog box or form when the application is not running in UserInteractive mode is not a valid operation. Specify the ServiceNotification or DefaultDesktopOnly style to display a notification from a service application." >> TerminatingError(New-ExoPSSession): "Showing a modal dialog box or form when the application is not running in UserInteractive mode is not a valid operation. Specify the ServiceNotification or DefaultDesktopOnly style to display a notification from a service application." >> TerminatingError(New-ExoPSSession): "Showing a modal dialog box or form when the application is not running in UserInteractive mode is not a valid operation. Specify the ServiceNotification or DefaultDesktopOnly style to display a notification from a service application." Showing a modal dialog box or form when the application is not running in UserInteractive mode is not a valid operation. Specify the ServiceNotification or DefaultDesktopOnly style to display a notification from a service application. New-ExoPSSession : Showing a modal dialog box or form when the application is not running in UserInteractive mode is not a valid operation. Specify the ServiceNotification or DefaultDesktopOnly style to display a notification from a service application. -------------------------------------------------------------------------- I have tried a workaround here, 1. Schedule the script to "Run only when user is logged on" 2. Disconnect or lock the server session Does anyone has any ideas how we can schedule the script without having to leave the server session open?36KViews0likes10CommentsThe total data received from the remote client exceeded the allowed maximum. The allowed maximum ...
I'm running this command in Exchange Online PowerShell to Check permission of a User on all mailboxes in the Organization (For Auditing Purpose) - 1. Get-Mailbox -ResultSize Unlimited | Get-MailboxPermission -User Ankit (Fails ) 2. Get-Mailbox -ResultSize Unlimited | Get-MailboxPermission -User Ankit | Export-csv (Fails ) 3. $Mailboxes = Get-Mailbox -ResultSize Unlimited $mailboxes | Get-Mailboxpermission -user Ankit | Export-csv (Fails 4. $mailboxes |Get-MailboxPermission -User Ankit ; Start-Sleep -Milliseconds 500| Export-Csv All of them fail with Error - Sending data to a remote command failed with the following error message: The data in the command exceeded the maximum size that is allowed by the session configuration. The allowed maximum is 500 MB. Change the input, use a different session configuration, or change the "PSMaximumReceivedObjectSizeMB" and "PSMaximumReceivedDataSizePerCommandMB" properties of the session configuration on the remote computer. For more information, see the about_Remote_Troubleshooting Help topic. + CategoryInfo : OperationStopped: (outlook.office365.com:String) [], PSRemotingTransportException + FullyQualifiedErrorId : JobFailure + PSComputerName : outlook.office365.com Sending data to a remote command failed with the following error message: The total data received from the remote client exceeded the allowed maximum. The allowed maximum is 524288000. For more information, see the about_Remote_Troubleshooting Help topic. + CategoryInfo : OperationStopped: (outlook.office365.com:String) [], PSRemotingTransportException + FullyQualifiedErrorId : JobFailure + PSComputerName : outlook.office365.com18KViews0likes2CommentsImport-CSV data into to set variables in a script
Good morning all, I don't know much about PowerShell but I am trying to create an script that variable data from each row in CSV file and input data to create the mailbox. For example: CSV: Username, Servername, ServerCode Bob,jane, DC101, 101 Input variable to the following: "Enable-Mailbox -identity "Domianname\User.name" - Database MBDB01-code -PrimarySMTPAddress "User.Name@email.address" -domain controller FQDN_servername" Where User.name = CSV.Username code = CSV.servercode FQDN_servername = CSV.servername Then the result will either out put the Enable-Mailbox line to .txt file or run each Enable-mailbox line RegardsSolved17KViews0likes2CommentsGet users personal contacts with Powershell for office365/Exchange
Hi All, I am trying to retrieve user's personal contact on outlook web . I have tried with following cmdlets but non of them giving the list of contacts. Get-Contact Get-Addresslist Get-MailContact Get-MailboxFolder any help would be highly appreciated. Thanks,Solved14KViews0likes4CommentsFind user without mailbox
Hi. Im trying to create a script that loads users from an AD Group and filter them based on an attribute. My goal is to have a script that loads users from a group, finde the ones that do not have a mailbox in my exchange inviroment, and mail enable them. Right now im stuck on the "finde the users". My Scirpt so far: #---------------------------------------------------------- # LOAD AD MODULES #---------------------------------------------------------- Import-Module ActiveDirectory -ErrorAction Stop #---------------------------------------------------------- # IMPORT MEMBERS OF GROUP #---------------------------------------------------------- $Users = Get-ADGroupMember -Identity "S_Enable_Exch2010User" $Users | ForEach{Get-ADUser -filter {-not(msExchMailboxGuid -like "*")}} How ever, this looks at all users in my AD and not the ones in $Users. What am I doing wrong....????Solved13KViews0likes3Commentsonly | Export-csv is having an issue exporting the data, the rest of the PS works fine
i run the below against a CSV file and works fine on exchange online PS, foreach($m in $mailboxes) {Get-MailboxStatistics $m.Identity.ToString() |select Identity, displayname, LastLogonTime, itemcount, totalitemsize; Start-Sleep -Milliseconds 500} however when i add the Export-csv switch it only gets one user info exported, the last user in the list i tried altering the line in many ways something is wrong while exporting the results only , the results are retrieved successfully on-screen when the command is fired without the Export parameter foreach($m in $mailboxes) {Get-MailboxStatistics $m.Identity.ToString() |select Identity, displayname, LastLogonTime, itemcount, totalitemsize; Start-Sleep -Milliseconds 500 -Export-csv d:\123.csv}Solved8.1KViews0likes4Comments