If you need more help, you could post your issue in one drive forum. SHOULD I DISABLE MICROSOFT ONEDRIVE STARTUP OFFLINEWhen viewing the corresponding folder in the online, the file is still continuing toįor SharePoint, I could only recommend you disable Offline Client Availability. #$sPassword= ConvertTo-SecureString "" -AsPlainText -ForceĮnableDisable-SyncSPODocLibrary -sSiteUrl $sSiteUrl -sUserName $sUserName -sPassword $sPassword -sCSOMPath $sCSOMPath -sDocLibraryName $sDocLibraryName -sOperationType $sOperationTypeĪs I test, if I stop sync in local one drive app, one drive will keep only empty folders, all files in it are deleted. $sSiteUrl = " $sUserName = Read-Host -Prompt "Enter your password: " -AsSecureString Write-Host -ForegroundColor Red $_.Exception.ToString() Write-Host "Requested operation is not valid" -ForegroundColor Red Write-Host "Disabling syncrhonization for document library $sDocLibraryName" -ForegroundColor Green Write-Host "Enabling syncrhonization for document library $sDocLibraryName" -ForegroundColor Green $spoCredentials = New-Object ($sUserName, $sPassword) Param ($sSiteUrl,$sUserName,$sPassword,$sCSOMPath,$sDocLibraryName,$sOperationType) #Definition of the function that allows to enable/disable syncrhonization option in a SharePoint Document Library # -> $sOperationType: Operation to be done (Enable / Disable). # -> $sDocLibraryName: Name of the Document Library. # -> $sUserName: User Name to connect to the SharePoint Online Site. # Script that allows to enable / disable syncrhonization option in a SharePoint Document Library To use at least the August 2016 version of the CSOM for SPO that includes the property ExcludeFromOfflineClient. In order to get the script working, you need I added /background to prevent the explorer window from opening.īelow script allows to enable / disable the synchronization option in an existing SharePoint Online (SPO) document library by using the Client Side Object Model (CSOM) in a function designed to make that job. Start-Process "$env:LOCALAPPDATA\Microsoft\OneDrive\OneDrive.exe" /background Remove-Item "$env:USERPROFILE\\$ProjectNumber - D" -Recurse -Force Rename-Item ($f.FullName '2') $f.FullName SHOULD I DISABLE MICROSOFT ONEDRIVE STARTUP CODEHere is the code to start a new sync (I like to override the original library name from "Documents" to "D" to keep the pathname shorter): function Start-LibrarySync | Set-Content ($f.FullName '2') -Encoding Unicode I wasn'tĪble to avoid it, perhaps I will try to wait half a second and close it. When OneDrive.exe restarts, it opens a File Explorer window. There is one thing that I wsan't able to fix: in order to stop a sync, the script shuts down OneDrive.exe, remove and modifies some files, removes a registry value and restarts OneDrive.exe. Still need help? Go to Microsoft Community.It is my first PowerShell script, so I struggled with managing text files, regular expressions, registry, etc., and I'm sure it doesn't look much like a PowerShell script should look like, but I have a working prototype. If your company’s administrator decides to disable OneDrive’s consumer sync app but to enable OneDrive for work or school, see Use Group Policy to control OneDrive sync app settings. This issue occurs when there's a Group Policy setting on the computer that prevents OneDrive for work or school from starting. If you decide to manually change this key or to remove the key without having your administrator change the policy for your computer, the next time the policy runs (typically after a restart, after you sign in to Windows, or after periodic updates), the policy is reapplied, and OneDrive for work or school won't start again. If the registry value was set as part of a Group Policy Object, the policy must be removed. In order to sync with OneDrive for work or school, the DisableFileSyncNGSC key must be removed or the DWORD value must be changed to 0 (zero). HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\OneDrive Before you modify it, back up the registry for restoration in case problems occur. Serious problems might occur if you modify the registry incorrectly. Important: Follow the steps in this section carefully.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |