rodneyviana / ODSyncService

OneDrive service/DLL for Sync State
MIT License
93 stars 26 forks source link

Oddity of ./ required in path ignorer to run #9

Closed vspiars closed 4 years ago

vspiars commented 4 years ago

Hello. Thank you for all of your work on this tool. As a rep at an EDU this is huge. Here's the issue: 1) We are able to get the tool to run ONLY on physical machines (VMs produce an error) 2) In order to run on a physical machine the command must be "Import-Module ./OneDriveLib.dll". 3) We have tried placing the .dll file at the root of C, in the PowerShell directory and there is no change in how it must be run. Any ideas as to why the path must be ./? It is way to script but it is just odd.

As for the VMs, there is a host of stuff to weed through before I can really provide any useful info for this (like--build and patch version of OS and if physical and VM differ, permissions but it seems to occur independent of who is logged in and what access they have (admin or user), It is a Citrix environment but not sure of version/patch level, etc). So, any ideas on the initial import path item on physical machines would be great.

Win10 Enterprise-- Version 1903 (OS Build 18362.535)

Best, Vince

rodneyviana commented 4 years ago

Vince,

Thanks for the feedback.

I made a few changes and there is a new version of the component that is digitally signed.

  1. I tested on a fresh VM just now and it worked. However, I believe I found what your problem is. My VM came with GPO (group policy) that would run applications as administrator if the user was administrator and the component does not work in elevated privileges. After I changed the policy, it worked. This is how you change the policy to run as elevated only when it is requested: 1.a. Open Local Security Policy 1.b. Expand "Local Policies" on the left side 1.c. Find "User Account Control: Use Admin Approval Mode for the built-in Administrator account" on the right side and make sure it is "Enabled". If it is not specified or Disabled it will run as administrator all applications.

image

2./3. You can put the dll elsewhere but on c:\ as it will require elevated privileges to access the root folder. Save to a folder like C:\OD and you can run "Import-Module C:\od\OneDriveLib.dll".

You may see what is happening under the hood by running with log enabled. Example:

Import-Module C:\od\OneDriveLib.dll
Get-ODStatus -IncludeLog $true
# use this to find the log file(s)
Get-Item -Path "$($env:Temp)\OneDriveLib*" | % { & notepad.exe $($_.FullName) }
vspiars commented 4 years ago

Wowzerz! Thank you for the reply. And the work and testing!! I’ll update my colleague with this cv judo (forward). Much appreciated.

Best, Vince

On Feb 13, 2020, at 4:44 PM, Rodney Viana notifications@github.com wrote:

 Vince,

Thanks for the feedback.

I made a few changes and there is a new version of the component that is digitally signed.

I tested on a fresh VM just now and it worked. However, I believe I found what your problem is. My VM came with GPO (group policy) that would run applications as administrator if the user was administrator and the component does not work in elevated privileges. After I changed the policy, it worked. This is how you change the policy to run as elevated only when it is requested: 1.a. Open Local Security Policy 1.b. Expand "Local Policies" on the left side 1.c. Find "User Account Control: Use Admin Approval Mode for the built-in Administrator account" on the right side and make sure it is "Enabled". If it is not specified or Disabled it will run as administrator all applications.

2./3. You can put the dll elsewhere but on c:\ as it will require elevated privileges to access the root folder. Save to a folder like C:\OD and you can run "Import-Module C:\od\OneDriveLib.dll".

You may see what is happening under the hood by running with log enabled. Example:

Import-Module C:\od\OneDriveLib.dll Get-ODStatus -IncludeLog $true

use this to find the log file(s)

Get-Item -Path "$($env:Temp)\OneDriveLib*" | % { & notepad.exe $($_.FullName) } — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.