How to sync Drive :\D path for OneDrive, automated in Intune MS365

  • هذا الموضوع فارغ.
  • Post
    Weekend Wiki
    مدير عام
    To automate syncing a specific folder, such as D:\Path, to OneDrive using Microsoft Intune, follow these steps:


    1. Configure OneDrive to Sync Specific Folders

    OneDrive must be installed and properly configured. Here’s how to ensure your D:\Path folder syncs automatically:

    Enable Known Folder Move (Optional)

    If you want to redirect standard folders (e.g., Desktop, Documents), you can configure the “Known Folder Move” setting in Intune. If you’re syncing a custom folder, continue below.


    2. Prepare the OneDrive Client on Devices

    1. Install OneDrive (if not already installed):
      • Make sure the latest version of OneDrive is installed on the target devices.
      • For silent installations via Intune, use the OneDriveSetup.exe /silent command.
    2. Configure OneDrive Settings:
      • Ensure users are automatically signed in by configuring the Intune policy for OneDrive auto-configuration:
        • Go to Microsoft Endpoint Manager Admin Center > Devices > Configuration profiles > + Create Profile.
        • Select Windows 10 and later as the platform, and choose Templates > Administrative Templates.
        • Search for “OneDrive” and configure:
          • Silently sign in users: Enable.
          • Silently move Windows known folders to OneDrive: Optional.

    3. Use Intune PowerShell Scripts to Sync Custom Paths

    To sync a custom folder like D:\Path, you can use a PowerShell script deployed via Intune.

    Script Example:

    # Define the local folder path
    $LocalFolder = "D:\Path"
    
    # Define the OneDrive sync path (replace "<UserEmail>" with the placeholder)
    $OneDriveFolder = "$env:USERPROFILE\OneDrive\<UserEmail>\Path"
    
    # Check if the folder exists
    if (Test-Path -Path $LocalFolder) {
        # Create the destination folder in OneDrive if it doesn't exist
        if (!(Test-Path -Path $OneDriveFolder)) {
            New-Item -ItemType Directory -Path $OneDriveFolder
        }
    
        # Copy the files to OneDrive
        Copy-Item -Path $LocalFolder\* -Destination $OneDriveFolder -Recurse -Force
    }
    
    # Start OneDrive sync (optional)
    Start-Process -FilePath "C:\Program Files\Microsoft OneDrive\OneDrive.exe"
    

    Deployment:

    1. Save the script as a .ps1 file.
    2. Go to Microsoft Endpoint Manager Admin Center > Devices > Scripts > Add Script.
    3. Upload the script and assign it to target devices.

    4. Configure Intune Policies for OneDrive Sync

    In Intune, you can define settings to ensure that the sync happens automatically.

    1. Create a Device Configuration Profile:
      • Go to Devices > Configuration profiles > + Create Profile.
      • Select Windows 10 and later > Templates > Administrative Templates.
      • Configure:
        • Prevent users from changing the location of their OneDrive folder: Enable.
        • Set the default location for the OneDrive folder: Set to a desired path.
        • Enable automatic syncing of specific folders: Add the folder path you want to sync.
    2. Deploy the Configuration Profile:
      • Assign it to the user or device group.

    5. Monitor Sync Status

    In Intune:

    • Go to Devices > Monitor > Device status or User status to track compliance and policy application.
    • Use the OneDrive admin console to check syncing errors or settings compliance.

    Would you like detailed steps for creating policies, or assistance with deploying this for multiple users?

  • يجب تسجيل الدخول للرد على هذا الموضوع.
arArabic