User Profile
Kevin_Morgan
Iron Contributor
Joined 9 years ago
User Widgets
Recent Discussions
Re: Bulk Disable Azure AD Users
abedinthehouse The command to disable Azure AD user is: Set-AzureADUser -ObjectID "user_upn_or_id" -AccountEnabled $false You can just change the line as like below one: Set-AzureADUser -ObjectID $user.ObjectId -AccountEnabled $false Refer this post to update bulk Azure AD User attributes: https://morgantechspace.com/2022/03/update-bulk-azure-ad-user-attributes-using-powershell.html If you're interested in updating bulk Office 365 user profile information without using PowerShell, try the Office 365 Manager from Specmasoft. This tool helps you modify bulk M365 users using CSV, update licenses, add bulk members to groups, and more. https://specmasoft.com/office-365-manager/update-bulk-azure-ad-users-in-microsoft-365-using-a-csv-file26KViews1like1CommentRe: Bulk update Azure AD with user attributes from CSV
dnelsonazpain Hi, You have to use the ExtensionProperty to set the null value or clear the property with Set-AzureADUser cmdlet. $properties = [Collections.Generic.Dictionary[[String],[String]]]::new() $properties.Add("Mobile", [NullString]::Value) Set-AzureADUser -ObjectId "email address removed for privacy reasons" -ExtensionProperty $properties # Refer to the below post for more details. # https://morgantechspace.com/2022/03/update-bulk-azure-ad-user-attributes-using-powershell.html Check this post for more details: https://morgantechspace.com/2022/09/remove-or-clear-property-or-set-null-value-using-set-azureaduser-cmdlet.html Check out https://specmasoft.com/office-365-manager/update-bulk-azure-ad-users-in-microsoft-365-using-a-csv-file from https://specmasoft.com/office-365-manager to update bulk user attributes, including setting a manager, updating licenses, and managing extension attributes (e.g., employeeId). You can also set null values or clear existing property values. Additionally, the tool allows you to update passwords for bulk users and add multiple users to any groups or teams. https://specmasoft.com/office-365-manager/update-bulk-azure-ad-users-in-microsoft-365-using-a-csv-file4.2KViews0likes1CommentRe: List all users' last login date
Donald Mosteller The Microsoft Graph API now supports the resource property signInActivity in users end-point, this resource exposes the lastSignInDateTime property which shows the last time a user made a successful sign-in. Fetching signInActivity property requires an Azure AD Premium P1/P2 license and the AuditLog.Read.All permission. The following request retrieves user details along with signInActivity property. #GET Request https://graph.microsoft.com/beta/users?$select=displayName,signInActivity You can refer the below post to know more details about how to find and export Last login date for all Azure AD Users using PowerShell. https://morgantechspace.com/2021/09/find-last-login-date-for-all-azure-ad-users-using-powershell.html21KViews0likes3CommentsRe: get-unique command get me wrong results in powershell
Dabby Can you try the following command to get unique objects by specific property name. $users.count $A = $users | Select-Object -Unique -Property name $A.count Read this post for more details : https://morgantechspace.com/2021/11/find-unique-object-items-by-property-in-powershell-array.html1.4KViews1like1CommentRe: Unable to connect sharepoint online site collection using powershell
Kevin_Morgan The point is: You can't connect the individual site collection using this command (Connect-SPOService ). The command is designed to connect only with admin site. Once you connected the Admin site, you can use the following command to get specific site details. Get-SPOSite -Identity https://contoso.sharepoint.com And you can use the commands listed in the below post to manage SPO sites. https://docs.microsoft.com/en-us/powershell/module/sharepoint-online/?view=sharepoint-ps You can use these commands only to manage SPO sites and I believe, you can't manage specific list or list items using these commands. So, you have to either use PnP PowerShell or CSOM based PowerShell.3KViews1like0CommentsRe: Unable to connect sharepoint online site collection using powershell
Lokeswar_Reddy This is expected error since you need to pass the Admin site URL (Tenant site url) for Connect-SPOService. You can check this post : https://docs.microsoft.com/en-us/powershell/module/sharepoint-online/connect-sposervice Connect-SPOService -url https://TenantName-admin.sharepoint.com As you know, the Connect-SPOService cmdlet is belong to SPO Management module. For List items update, you have to either use CSOM based script or PnP PowerShell commands. $SiteUrl = "https://crescent.sharepoint.com/sites/marketing" $ListName = "CustomerContacts" $CSVPath = "C:\temp\CustomerContacts.csv" #Get CSV file content $CSVData = Import-CsV -Path $CSVPath #Connect to site Connect-PnPOnline $SiteUrl -Interactive #Iterate through each Row in the CSV and import as list item SPO List ForEach ($Row in $CSVData) { #Add List Items Add-PnPListItem -List $ListName -Values @{ "CustomerName" = $($Row.CustomerName); "Email" = $($Row.Email); "Mobile" = $($Row.Mobile); }; }3KViews1like2CommentsRe: What is the difference between "OtherMails" and "ProxyAddresses" when using PowerShell?
fstorer Actually, when you rename the user, the UPN and Primary SMTP address of the user get updated. In this case, the old primary email address is added as secondary email address. In Azure AD, the Primary SMTP Address and Alias Email Addresses are available in the ProxyAddresses attribute. Refer the below post to know more about how the proxyAddresses attribute is populated in Azure AD. https://docs.microsoft.com/en-us/troubleshoot/azure/active-directory/proxyaddresses-attribute-populate The OtherMails property is not related with the SMTP email address. This is a different property which populates the user's alternate email address which can be configured through Azure AD portal. Initially, I thought this is the email address that can be used for MFA or SSPR authentication, but this is not true since the email address for the Multi-factor authentication or SSPR is stored in different place. Hope, the OtherMails property is currently returns only the Alternate email address which is configured under the user's contact information. Refer the below image. Hope, VasilMichev provide more insight.15KViews1like0CommentsRe: Bulk update Azure AD with user attributes from CSV
Manfred101 - The below post shares the PowerShell script to modify bulk user attributes for multiple user accounts in a simple way by importing user details from a CSV file. https://morgantechspace.com/2022/03/update-bulk-azure-ad-user-attributes-using-powershell.html This script helps to update bulk user attributes as hash table in single command execution. #Hashtable to keep multiple attribute values $AttributesToUpdate = @{} $AttributesToUpdate["JobTitle"] = "Sales Manager" $AttributesToUpdate["Department"] = "Sales" # Set required user attributes. # Need to prefix the variable AttributesToUpdate with @ symbol instead of $ to pass hashtable as parameters (ex: @AttributesToUpdate). Set-AzureADUser -ObjectId "user@domain.com" @AttributesToUpdate # Refer to the below post for more details. # https://morgantechspace.com/2022/03/update-bulk-azure-ad-user-attributes-using-powershell.html9.7KViews0likes0CommentsRe: SharePoint online CSOM authentication fails in prod works in dev and test tenants
Dhi_V1800 We can use the OfficeDevPnP.Core assembly in PowerShell to create a SharePointContext object with different authentication types (ex: MFA). You can refer to this post : https://morgantechspace.com/2021/09/connect-to-sharepoint-site-with-mfa-account-using-csom-and-powershell.html Try the below commands. #Add required references to OfficeDevPnP.Core and SharePoint client assembly [System.Reflection.Assembly]::LoadFrom("C:\Program Files\WindowsPowerShell\Modules\SharePointPnPPowerShellOnline\3.29.2101.0\OfficeDevPnP.Core.dll") [System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint.Client") [System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint.Client.Runtime") $siteURL = "https://contoso.sharepoint.com/sites/siten_name" $AuthenticationManager = new-object OfficeDevPnP.Core.AuthenticationManager $ctx = $AuthenticationManager.GetWebLoginClientContext($siteURL) $ctx.Load($ctx.Web) $ctx.ExecuteQuery() Write-Host "Title: " $ctx.Web.Title -ForegroundColor Green Write-Host "Description: " $ctx.Web.Description -ForegroundColor Green6.2KViews0likes0CommentsRe: List all users' last login date
Joshua Bines Yes the value may get populated for all users. But we need the license to retrieve the lastlogin value through Microsoft Graph API. The https://docs.microsoft.com/en-us/graph/api/user-list?view=graph-rest-beta&tabs=http#example-3-get-users-including-their-last-sign-in-time itself still indicates the same and so my testing. Hope still there is no other API or PowerShell cmdlet to get the details without Azure AD Premium P1/P2 license. Can you please point me if you know any resources?42KViews0likes2CommentsRe: List all users' last login date
JakobRohde VasilMichev The Microsoft Graph API now supports the resource property signInActivity in users end-point, this resource exposes the lastSignInDateTime property which shows the last time a user made a successful sign-in. Fetching signInActivity property requires an Azure AD Premium P1/P2 license and the AuditLog.Read.All permission. The following request retrieves user details along with signInActivity property. #GET Request https://graph.microsoft.com/beta/users?$select=displayName,signInActivity Before Microsoft Graph supports this property, we need to either get the mailbox last logon time using the Get-MailboxStatistics cmdlet or we need to crawl the Azure AD sign-in logs or the Unified audit logs in the Security and Compliance Center. You can refer the below post to know more details about how to find and export Last login date for all Azure AD Users using PowerShell. https://morgantechspace.com/2021/09/find-last-login-date-for-all-azure-ad-users-using-powershell.html42KViews0likes4CommentsRe: How to run Exchage PowerShell - Exchange Online
PCHealer Are you asking for Exchange Online (Microsoft 365) Test environment ?. If so, follow the below steps. Go to the https://cdx.transform.microsoft.com/ (CDX) site. Navigate to My Environments. Under My Tenants, on the right-side, click Create Tenant button. Choose the required Tenant type, location, content type and proceed to create a new demo or trial tenant.4.6KViews1like0CommentsRe: How to run Exchage PowerShell - Exchange Online
PCHealer Start the Windows PowerShell console with "Run as administrator" privilege. Run the following command to install the Exchange Online Management powershell module. This is one time work. Install-Module ExchangeOnlineManagement Once you have installed the module successfully, you can run the following command to https://docs.microsoft.com/en-us/powershell/module/exchange/connect-exchangeonline service. Connect-ExchangeOnline Now, you can run the required Exchange commands to work with your Exchange service. Get-Mailbox # List mailboxes Get-EXOMailbox # List mailboxes using V2 module script. Provide faster output.5KViews0likes4CommentsRe: Refresh Token
Khaled_Arafat You are getting this error since your Refresh Token has been expired (I am sure, you already know this). By default, the lifetime for the refresh token is 90 days. The refresh token can be expired due to either if the password changed for the user or the token has been revoked either by user or admin through PowerShell or Azure AD portal. See https://docs.microsoft.com/en-us/azure/active-directory/develop/refresh-tokens#revocation post to know more about Refresh Token Expiration : https://docs.microsoft.com/en-us/azure/active-directory/develop/refresh-tokens#revocation If your token not expired by anyone of the listed method in the above post, then confirm that you have configured Conditional Access policy and configured the Session -> Sign-in frequency control. This is an another way to control user Refresh Token and force user to sign-in again. Refer the below post to know more about Authentication session management with Conditional Access. https://docs.microsoft.com/en-us/azure/active-directory/conditional-access/howto-conditional-access-session-lifetime60KViews0likes2CommentsRe: Why can't I assign licenses to every groups created using MS/Office 365 Admin center?
License can be applied for only security groups or security enabled Microsoft 365 (Unified) groups. In my recent test, the M365 group created from Azure AD Portal is created as security enabled group, but the group created from M365 Admin center is created without security enabled. So, this might be the problem for your case too, If you are facing problem with M365 group, then check Security Enabled field for the problematic group from Azure AD portal. You can also check this article : https://docs.microsoft.com/en-us/azure/active-directory/fundamentals/active-directory-licensing-whatis-azure-portal#features9.2KViews1like1CommentRe: How to add Identity column on PowerShell Result
amsrivas28 I can't understand your requirement clearly. But what my suggestion is, instead of breaking loop, use the counter variable, temporary array and result array., process 10 items and add the processed items in result array, reset the counter variable and temporary array once the count reached to 10. $resultArray = @() $counter=1 $tempArray = @() foreach ($workspace in $Workspaces) { ### Your inner loop script ### $tempArray += "$wspiden,$wspid , $dflowId" if($counter -eq 10) { #Add temp array in result array $resultArray += $tempArray #Reset counter and temp array $array = @() $counter=1 } }4.2KViews0likes1CommentRe: How to Fetch All the Group membership for a user in the Domain
PRIME_FIRE Not sure, in what environment you are looking this functionality. Use the below command in On-Premises Active Directory. Get-ADPrincipalGroupMembership UserName | Select Name Use the below command in Azure Active Directory. $objectId = (Get-AzureADUser -SearchString "user@contoso.com").ObjectId Get-AzureADUserMembership -ObjectId $objectId3.7KViews0likes1CommentRe: How to add Identity column on PowerShell Result
amsrivas28 Try the below script. The error message indicates that the command can't able to convert the custom ps object into Workspace object. So, we can use the parameter "WorkspaceId" and pass Workspace Id to get only dataflows belonging to that workspace. $array = @() foreach ($workspace in $Workspaces ) { $Dataflow = Get-PowerBIDataFlow -WorkspaceId $workspace.id }4.2KViews0likes3CommentsRe: How to add Identity column on PowerShell Result
amsrivas28 Try the below commands with Get-PowerBIWorkspace to get the required result $result=@() $id=0 $processes = Get-Process ForEach ($process in $processes) { $id++ $result+=New-Object PsObject -Property ([ordered]@{ ColA=$id OtherColumn1=$process.Name }) }4.2KViews0likes5Comments
Recent Blog Articles
No content to show