37 C
Dubai
Tuesday, May 6, 2025
Home Blog Page 23

One Drive Auto Login with Force Re Login using Proactive Remediation

Microsoft 365 One Drive Auto Account Configuration Roadmap | Microsoft 365 – Highly Recommended to wait for this roll out instead of these workarounds.

One Drive Sign-in Policies works like a charm on Hybrid AD Joined Devices but there are scenarios like Users will not re-login when it logs out after the rolling window of 90 days for re-authentication or user intentionally logs out from One Drive.

Percentage of Computers are Protected with Windows Known Folders are backed up (Recovery of Files incase of ransomware)
Educating the user is impossible to keep one drive logged in so that their folders are protected.

Let’s see how to

  • Force Sign in with Configuration Profiles (Settings Catalog – One Drive).
  • When user Logs out intentionally or logs out for re authentication – Use Remediation policy using Endpoint Manager to clear registry
  • Collect Admin Reports and get visibility on Microsoft 365 App Admin Center.

Force Sign in with Configuration Profiles (Settings Catalog – One Drive)

We assume Seamless Single Sign-on has been configured already. if you are using Hybrid Joined devices you need some additional configuration changes in Azure AD Connect. if it’s Azure AD joined you can follow without any additional configuration changes.

As we have Single Sign-on Available for all Corporate devices now. Now we need to Apply a Single Sign-on Policy for One Drive using Settings Catalog in the Endpoint manager and not using Group policies as we are phasing out group policies.

Let’s create a Configuration Profile for One Drive using Settings Catalog.

It’s a Configuration Profile to Stop users to sync external office 365 organizations in the Corporate laptops. Silently backup Windows known folders without any prompts for the user and Sync Admin Reports getting visibility in Config.office.com. You can change them as per your requirements.

Tenant ID can be found in Azure AD Portal Properties

Tenant Association Key can be found in Apps Admin Center Settings

Now the Single Sign-on is available for users to log in to their machines and One Drive Single Sign-on configuration profile to take effect for seamless login but if the users log out intentionally or it gets logged out for re-authentication let’s tackle them using proactive remediation policy with a script package (Feature inside endpoint analytics).

When a user Logs out intentionally or logs out for re-authentication

Lets create a Script package under proactive remediations

Detection and Remediation Script to clear the registry – SilentAccountConfig Registry

SilentAccountConfig creates a SilentBusinessConfigCompleted registry entry once SilentAccountConfig has successfully provisioned the user in OneDrive.exe. This prevents SilentAccountConfig from reprovisioning the user in OneDrive.exe if the user manually stops syncing.

Computer\HKEY_CURRENT_USER\Software\Microsoft\OneDrive

Detection Script –

function Test-RegistryValue {
param (
[parameter(Mandatory=$true)]
[ValidateNotNullOrEmpty()]$Path,
[parameter(Mandatory=$true)]
[ValidateNotNullOrEmpty()]$Value
)
try {
Get-ItemProperty -Path $Path | Select-Object -ExpandProperty $Value -ErrorAction Stop | Out-Null
return $true
}
catch {
return $false
}
 }
if ( Test-RegistryValue -Path 'HKCU:\Software\Microsoft\OneDrive' -Value 'SilentBusinessConfigCompleted')
{
exit 1
}
ELSE {
exit 0
}

Remediation Script –

reg delete HKCU\Software\Microsoft\OneDrive /v SilentBusinessConfigCompleted /f

Now you can see Proactive Remediation analytics on how many machines the registry getting cleared. So that you can make sure everything is going as per your plan to improve One Drive Adoption by increasing the Sign-ins

Collect Admin Reports and get visibility on Microsoft 365 App Admin Center

One Drive Sync Health can provide you good visibility on how much Known Folders are backed up in your environment. So that you can be aware of the percentage of recovery in some disaster recovery scenarios.

As you know you can restore your entire One Drive to a certain date it helps in recovery scenarios from Desktop Crashes to Ransomware.

Defender for Endpoint Installation Error

Microsoft Defender for Endpoint installation throws an Error with McAfee On-Access Scanner enabled.

Error : Could not set file security for file “C:\ProgramData\Microsoft\Windows Defender\Definition Updates\’ Error:0
Verify that you have sufficient privileges to modify the security permission for this file.”

Solution –

Stop the On-Access Scanner. Delete the Windows Defender folder on below location
C:\ProgramData\Microsoft
and re-install them with Access Protection and On-Access Scanner Off.

After adding the below exclusions in McAfee, We were able to install without disabling McAfee.

Low Risk Processes - 
MsSense.exe
MSMPEng.exe

Excluded Location - 
%ProgramFiles%\Windows Defender Advanced Threat Protection
%ProgramFiles%\Windows Defender
%\ProgramData%\Microsoft\Windows Defender
%\ProgramData%\Microsoft\Windows Defender Advanced Threat Protection

Find Azure AD Inactive Users using Powershell and Graph

Finding Inactive users with the Last Logon Date from the Azure Active Directory has never been easier. LastSignInDateTime property was introduced in Microsoft Graph to make it easier for Admins to retrieve so that cleanup can be done periodically.

There are numerous ways to retrieve this property, Simplified the whole process with a few lines of code so that it doesn’t complicate starters to retrieve them from Azure AD. Please note this requires the tenant to have Azure AD P1 or P2 license
if you don’t have the required license to retrieve this property, you will get the below error.

“error”:{“code”:”Authentication_RequestFromNonPremiumTenantOrB2CTenant”,”message”:”Neither tenant is B2C or tenant doesn’t have premium license”

Firstly we need an Azure AD App Registration with a few permissions like AuditLog.Read.All and Directory.Read.All
Let’s create an App Registration,

I have named it UserSigninLogs

App is Created

Client Secret is Created.

Add the required permissions, AuditLog.Read.All and Directory.Read.All and Grant Admin Consent.

Now we have the Application ID and Directory ID and Client Secret for our Script to retrieve data via Microsoft Graph.

After replacing the above value you can retrieve them into a CSV file. You can change the number and CSV file name as per your requirements, or run without parameters it will take default values.

.\AzureAD_Inactive_Users.ps1 -LastLogonDays 90 -CSVFileName 90daysinactive.csv


.\AzureAD_Inactive_Users.ps1 -LastLogonDays 60 


.\AzureAD_Inactive_Users.ps1 

CSV Format

Download from GitHub –

AzureAD_Inactive_Users/AzureAD_Inactive_Users.ps1 at main · azure365pro/AzureAD_Inactive_Users (github.com)

Adding and Removing Devices to Apple Business Manager with Endpoint Manager

Adding devices to Apple Business Manager manually is not easy anymore .Simplest option is to use the reseller number or customer number to get the devices added or use Apple Configurator to add them into Apple Business Manager.

Lets see how to add / remove devices to Apple Business Manager integrated with Endpoint manager. Connect the Apple Device to Apple MAC desktop or laptop , Make sure Apple Configurator 2 is installed.

Download and install Apple Configurator

Lets create a Wi-Fi profile so that the device can connect to internet upon boot.
Apple Configurator 2 – New Profile – Wi-Fi

https://appleconfigurator2.manage.microsoft.com/MDMServiceConfig?id=db8a1bf4-ff05-4f5c-8d44-0889fe322677&AADTenantId=5b0f46f6-f5f0-4431-b09f-45c105f0c459

For – An unexpected error has occurred – Provisional enrollment failed – The Cloud configuration server is unavailable. Make sure Internet sharing is ON on MAC. So that it goes through successfully.

Utilizing On-Premises Hybrid Server for Office 365 Signatures

We love third-party software for centralized signatures because of the capability which they provide which we couldn’t achieve in Exchange Natively nor Office 365 till over the past decade. Signature software’s started providing cloud capabilities to route the email to their cloud to get them stamped. But some companies don’t want to route the email to their third-party cloud due to security and regulatory reasons even though they provide confidence saying they go via the same Azure infrastructure which is totally understood. Also, government agencies don’t want to route their email into a different country just for signatures even they wish to consume what the cloud provides them. As technology evolves in the Microsoft Graph space we have to wait for the options on how a signature can be applied to the mail transport layer without routing the whole email to different infrastructure.

To work around this situation, We can utilize the On-premises Exchange servers which are in hybrid to stamp the signature for Office 365 Internal Mail flow by creating a transport rule with additional headers. let’s see how to implement them.

You need to rerun the Hybrid wizard and enable centralized transport in order to achieve it. The most important thing before you need to enable centralized transport is if your MX is still pointing to On-premises servers your Office 365 groups will stop working if you are not using a dedicated group domain as it doesn’t currently support hybrid even though having group writeback enabled.

So you have to give up Office 365 groups, or you need to plan to move your MX to cloud or you need to have a dedicated group domain for office 365 groups so that it doesn’t need to come through this. Also, you have to understand that your Office 365 mail flow is going to pass through these servers. make sure you’re on-prem servers have enough juice. all your objects have to be synced and a proper hybrid should be in place. as the cloud object should be there in on-prem to give the email back to office 365.

We need a dedicated connector where the custom transport rule can use it. In order to forward the internal office 365 mail flow to the On-premises server for signatures. In simple words, we are adding a header value and divert all the office 365 emails to on-prem and on-prem object has a target address to the cloud and transport rule will not apply while it’s coming back. while it comes back the signature software on the exchange servers stamps the signature on the email as it’s on the transport layer.

OnPremisesForwardAll is the Connector we created. Sharing all the connectors. so that you will get an understanding of how all the connectors fall into space in a hybrid scenario with default connectors in place.

Let’s create the OnPremisesForwardAll connector before we create the transport rule.

exchange online – ECP – connectors – create a new connector –

Choose From Office 365 – Your Organizations email server

new connector

Only when I have a transport rule set up that redirects messages to this connector

How do you want to route email messages? your hybrid server public IPs

always to transport layer security with proper SSL in place

Next and Save the Connector.

Now let’s create a transport rule to use the connector

Added an exception for the message type automatic Reply. Otherwise out of office messages will not work within office 365 users.

Name – OnPremisesForward

The sender is located “Inside the Organization”

Set the message header to this value X-OnPremisesForward to the value true

Use the following connector

Except if

a message header includes X-OnPremisesForward

you need this – otherwise, your planner comments will be added with signatures which may look a bit ugly.

or

a message header matches

X-MS-Exchange-UnifiedGroup-SubmittedViaGroupAddress matches /o=ExchangeLabs/ou=Exchange Administrative Group

Now all your Office 365 users and On-Prem users are stamped with the same signature without the email getting routed elsewhere.

Disconnect Managed Google Play Account in Endpoint Manager

Task: Unbind the existing Google Managed Account and add the new Business account to manage Android devices. As the associated account doesn’t follow a standard naming convention. It was a random Gmail account. It wasn’t allowed to disconnect the account. Let’s see how to safely disconnect and map with a new account.

  • Go to Endpoint manager – devices – Android – android enrollment
  • On android enterprise, choose managed google play to see the existing account binds to your organization
  • When you disconnect, it will not allow you to unbind the account because organization has few devices enrolled with existing settings.

An Error occurred while unbinding managed google plan. Please unenroll all Android devices with a work profile.

  • Here are the few existing devices, which is already enrolled with the existing organization managed account
  • Click on the ellipse on the foundation information and choose to delete the organization.
  • Delete the organization after confirming the enterprise ID. “Read and acknowledge the warning”.
  • Once the organization is deleted, choose the android devices, and select retire.
  • This to be done on all the devices before adding the new account.
  • Once the device is retired, all the devices need to be deleted from the Intune portal using bulk options.
  • once all the devices are deleted, go to the same settings, managed google play and choose to disconnect the existing account.
  • after a successful unbind of existing account, launch a google to connect now to manage your organization play store.
  • Enter all the corresponding details and affirmate to link with your organization.
  • Once the new account is linked, you can see the setup status as healthy.
× How can I help you?