powershell
20 TopicsPowershell command to get all users with specific service plan
Hi all, I am looking for a powershell command to get list of all users with specific plan in Office 365. E.g. I need to get all users with Teams enabled in Office 365. I tried the following command and it didn't return anything. Get-MsolUser -All | Where-Object {($_.licenses).AccountSkuId.ServicePlan -match "Teams1"} | select DisplayName, UserPrincipalName I can run following command to find users with specific license, e.g. users with Office 365 E3 license, however still no success with specific plans inside E3 license Get-MsolUser -All | Where-Object {($_.licenses).AccountSkuId -match "ENTERPRISEPACK"} | select DisplayName, UserPrincipalName Any help, will be greatly appreciated. Thanks in Advance.Solved21KViews0likes2CommentsHow to check date of license assignment ?
Hi, Is there a Powershell script that shows you when ( for example ) a Visio license has been assigned to a user ? We have 50 Visio licenses and I would like to know when a user had this license assigned. Thanks in advance for your help.19KViews0likes1CommentAssign "Phone Sytem"/MCOEV only to multiple users in O365.
Hello, I have many users which have E5 licenses assigned to them, the only service which is turned off in the E5 pack is "Phone System" I want to enable the "Phone System" for all the users but it doesn't works using the below command set/script, I have tried multiple scripts available on the technet. Below is the script which I have used to enable the "Phone System" $UserPrincipalName = 'user@abcxyzx.com' $UsageLocation = 'US' Set-MsolUser -UserPrincipalName $UserPrincipalName -UsageLocation $UsageLocation Set-MsolUserLicense -UserPrincipalName $UserPrincipalName -AddLicenses XXXXXXX:ENTERPRISEPREMIUM $options = New-MsolLicenseOptions -AccountSkuId "XXXXXXX:ENTERPRISEPREMIUM" -DisabledPlans BPOS_S_TODO_3,FORMS_PLAN_E5,STREAM_O365_E5,THREAT_INTELLIGENCE,Deskless,FLOW_O365_P3,POWERAPPS_O365_P3,TEAMS1,ADALLOM_S_O365,EQUIVIO_ANALYTICS,LOCKBOX_ENTERPRISE,EXCHANGE_ANALYTICS,SWAY,ATP_ENTERPRISE,MCOMEETADV,BI_AZURE_P2,INTUNE_O365,PROJECTWORKMANAGEMENT,RMS_S_ENTERPRISE,YAMMER_ENTERPRISE,OFFICESUBSCRIPTION,MCOSTANDARD,EXCHANGE_S_ENTERPRISE,SHAREPOINTENTERPRISE,SHAREPOINTWAC Set-MsolUserLicense -UserPrincipalName $UserPrincipalName -LicenseOptions $options It gives the below error Set-MsolUserLicense : Unable to assign this license because it is invalid. Use the Get-MsolAccountSku cmdlet to retrieve a list of valid licenses. At line:4 char:1 + Set-MsolUserLicense -UserPrincipalName $UserPrincipalName -AddLicenses sleepingf ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : OperationStopped: (:) [Set-MsolUserLicense], MicrosoftOnlineException + FullyQualifiedErrorId : Microsoft.Online.Administration.Automation.InvalidUserLicenseException,Microsoft.Online.Administration.Automation.SetUse rLicense Set-MsolUserLicense : Unable to assign this license. At line:6 char:1 + Set-MsolUserLicense -UserPrincipalName $UserPrincipalName -LicenseOptions $optio ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : OperationStopped: (:) [Set-MsolUserLicense], MicrosoftOnlineException + FullyQualifiedErrorId : Microsoft.Online.Administration.Automation.InvalidLicenseConfigurationException,Microsoft.Online.Administration.Automati on.SetUserLicense ##The same works with other Service plans like the Business Premium##10KViews0likes1CommentPowershell Script to Generate eDiscovery Case
Hello Everyone, Currently working on a series of scripts that I will be using to administrate Office365 regularly for my clients, including one to generate the eDiscovery search and export. In my script I found that the param -OneDriveLocation for New-ComplianceSearch comes up as an invalid parameter. The whole premise behind this is to automate the user decommissioning process as much as possible, even if the last step is to log into the compliance center and download the clickonce application to export the zipped up export, we can easily save 30~60 minutes per user decommissioning we have to run, with an average of 3 a day it allows my techs on our service desk to work on other tickets during that time frame.Solved3.8KViews0likes2CommentsCannot create Information Barrier Policy
Hi, I have created two segments within Information Barriers in Microsoft Purview. I have then tried to create a Policy that blocks one segment from the other using both the UI and PowerShell, but I get the same error every time. "Could not run the command New-InformationBarrierPolicy. Cause of the problem: The parameter(s) ModerationAllowed of the cmdlet New-ExoInformationBarrierPolicy is not allowed for the app 00000007-0000-0ff1-ce00-000000000000" Am I missing something? Is anyone else seeing this, or is it just me? Right now, I can create many policies at all.Solved1.7KViews0likes4CommentsExchange Online help with powershell
So long story short. We have 9 domains in our org and when people transfer from department to department we are required to disable their old account and create a new one or sometimes we have contractors that become FTE's. Most of the time the department allows them to take their mail but because it's a new account I have to migrate the mailbox in the recycle bin to the new one under the new account. I have scripted this process and everything is working except when I try to catch and use the Exchange GUID in a variable. After I grab it, I do a Write-Host and it prints just fine but when it gets to New-MailboxRestoreRequest to use the GUID, I get the following: I can copy and paste the output of the Write-Host in place of the variables and it works. I just don't want to have to do that every time. Here is the script with identifying information stripped. Thanks in advance for the help. #Connections Connect-ExchangeOnline $Session = New-PSSession –ConfigurationName Microsoft.Exchange –ConnectionUri http://exchangeServer/PowerShell/ -authentication Kerberos Import-PSSession $Session -disablenamechecking set-adserversettings -viewentireforest $true #Set your variables $upn='Jane.Doe' $oldDomain='thisdomain.com' $newDomain='thatdomain.com' #Get Old and New GUIDS $oldEmailGUID=get-exomailbox -SoftDeletedMailbox -UserPrincipalName $upn'@'$oldDomain -PropertySets all | select name,primarysmtpaddress,exchangeguid,legacy*,whencreated,whenchanged Write-Host $oldEmailGUID.ExchangeGuid $oldEmailGUID=$oldEmailGUID.ExchangeGuid $newEmailGUID=get-exomailbox -UserPrincipalName $upn'@'$newDomain -PropertySets all | select name,primarysmtpaddress,exchangeguid,legacy*,whencreated,whenchanged Write-Host $newEmailGUID.ExchangeGuid $newEmailGUID=$newEmailGUID.ExchangeGuid Start-Sleep -Seconds 5 #Copy Old mailbox to New Mailbox New-MailboxRestoreRequest -Name $upn -SourceMailbox $oldEmailGUID -TargetMailbox $newEmailGUID -AllowLegacyDNMismatch -CompletedRequestAgeLimit 7 -ConflictResolutionOption keepall –LargeItemLimit 5 #-BadItemLimit 2000 Start-Sleep -Seconds 5 #Add X500 forwarding address **must first remove from old account through AD #Get Old x500 $oldEmailX500=Get-exomailbox -SoftDeletedMailbox -UserPrincipalName $upn'@'$oldDomain -PropertySets all | select name,primarysmtpaddress,exchangeguid,legacy*,whencreated,whenchanged Write-Host $oldEmailX500.LegacyExchangeDN $fullX500ValueCheck='@{Add = X500:'+$oldEmailX500.LegacyExchangeDN+'}' Write-Host $fullX500ValueCheck #Add X500 forwarding address **must first remove from old account through AD Set-remoteMailbox -Identity $upn'@'$newDomain -EmailAddresses @{Add = 'X500:'+$oldEmailX500.LegacyExchangeDN} -verbose ##### Show Restore Status #### #get restore guid $mailboxRestoreRequestStatsGUID=Get-MailboxRestoreRequest -Name $upn Write-host $mailboxRestoreRequestStatsGUID.RequestGuid #Check Status **update guid from previous step Get-MailboxRestoreRequestStatistics -Identity $mailboxRestoreRequestStatsGUID.RequestGuid | select targetmailboxidentity,status,statusdetail,failuretype,message,estimatedtransfersize,bytestransferred,EstimatedTransferItemCount,itemstransferred,percentcomplete,*stalled*,overalldurationSolved1.5KViews0likes2CommentsAzure automation account script error
Hi I have an azure automation account and all runbooks are failing. I don't know why. As a test I only ran this command, and it fails too. $cred = Get-AutomationPSCredential -Name "Name" Import-Module ExchangeOnlineManagement Connect-ExchangeOnline -Credential $cred This is the job Exception log: Connecting to remote server outlook.office365.com failed with the following error message : Bad Request For more information, see the about_Remote_Troubleshooting Help topic. (Connecting to remote server outlook.office365.com failed with the following error message : Bad Request For more information, see the about_Remote_Troubleshooting Help topic.) Any ideasSolved1.4KViews0likes3CommentsTrying to update old dynamic distribution group to include exchange contacts
Im trying to update an old dynamic distribution group to include exchange contacts. Can anyone help with this? ((((((((((((((((((((((CustomAttribute1 -ne 'EXCLUDE') -and (RecipientType -eq 'UserMailbox'))) -and (-not(Name -like 'SystemMailbox{*')))) -and (-not(Name -like 'CAS_{*')))) -and (-not(RecipientTypeDetailsValue -eq 'MailboxPlan')))) -and (-not(RecipientTypeDetailsValue -eq 'DiscoveryMailbox')))) -and (-not(RecipientTypeDetailsValue -eq 'PublicFolderMailbox')))) -and (-not(RecipientTypeDetailsValue -eq 'ArbitrationMailbox')))) -and (-not(RecipientTypeDetailsValue -eq 'AuditLogMailbox')))) -and (-not(RecipientTypeDetailsValue -eq 'AuxAuditLogMailbox')))) -and (-not(RecipientTypeDetailsValue -eq 'SupervisoryReviewPolicyMailbox')))) -and (-not(Name -like 'SystemMailbox{*')) -and (-not(Name -like 'CAS_{*')) -and (-not(RecipientTypeDetailsValue -eq 'MailboxPlan')) -and (-not(RecipientTypeDetailsValue -eq 'DiscoveryMailbox')) -and (-not(RecipientTypeDetailsValue -eq 'PublicFolderMailbox')) -and (-not(RecipientTypeDetailsValue -eq 'ArbitrationMailbox')) -and (-not(RecipientTypeDetailsValue -eq 'AuditLogMailbox')) -and (-not(RecipientTypeDetailsValue -eq 'AuxAuditLogMailbox')) -and (-not(RecipientTypeDetailsValue -eq 'SupervisoryReviewPolicyMailbox')))Solved1.3KViews0likes6CommentsMax number of bulk user attributes change per script
Hi, I want to ask. If I want to bulk change user attributes with powershell azureAD by importing a Csv file, what is the max number of user attributes that can be changed with a single script from a single csv file? Is there a limit to the max users in a single csv file that can be processed? Here is what I am planning to do: 1. First script. Import-CSV "C:\UserAttributes.csv" | Foreach { Set-AzureADUser -ObjectID $_.UserPrincipalName -Department $_.Department -JobTitle $_.Title -Surname $_.LastName -GivenName $_.FirstName -DisplayName $_.DisplayName } With this script I want to change the users' department, job title, firstname, lastname and displayname. 2. Second script Import-CSV "C:\UserAttributes.csv" | ForEach-Object { $CPW = $_.Password $CPWS = ConvertTo-SecureString -String $CPW -AsPlainText -Force Set-AzureADUserPassword -ObjectId $_.UserPrincipalName -Password $CPWS -EnforceChangePasswordPolicy:$false } With this script I want to re-assign new password to users. 3. Thrid script Import-CSV "C:\UserAttributes.csv" | Foreach { Set-AzureADUser -ObjectID $_.UserPrincipalName -UserPrincipalName $_.UPN } With this script I want to change the users' email. The 3 scripts above are tested and run perfectly with 10 test users that I created. So, back to my question. Is there any limit to the max number of users in one csv file that can be processed with every single script above? Just to let you know, there are 620s users in my department and around 7000 users in the whole organisation. If I can do it at once with a single csv file that will be very convenient. Thank youSolved1.2KViews0likes2CommentsAdministraton of Office installation from Powershell
Hello, is there any way, how to get in Powershell a list of all installation of Office Pro Plus with username and name of computers where the software is installed. I would like to also Deactivate specific Office installation from Powershell but I can´t to find the right command. It seems that there is no Powershell management for Office installation in O365, right?1.1KViews0likes1Comment