Loading mbackup.fsproj +1 −1 Original line number Diff line number Diff line Loading @@ -6,7 +6,7 @@ <RuntimeIdentifiers>win10-x64</RuntimeIdentifiers> <RootNamespace>Mbackup</RootNamespace> <TreatWarningsAsErrors>true</TreatWarningsAsErrors> <Version>0.4.6.0</Version> <Version>0.4.7.0</Version> </PropertyGroup> <ItemGroup> Loading mbackup.wxs +2 −2 Original line number Diff line number Diff line Loading @@ -94,7 +94,7 @@ Impersonate="no" Execute="deferred" Directory="TARGETDIR" ExeCommand=""[SystemFolder]SCHTASKS.EXE" /Create /RU SYSTEM /RP /NP /SC ONLOGON /TN "mbackup-logon" /TR "[MBACKUP_PROGRAM_FILES]publish\mbackup.exe" /DELAY 0015:00" /> ExeCommand=""[SystemFolder]SCHTASKS.EXE" /Create /RU BUILTIN\USERS /RP /NP /SC ONLOGON /TN "mbackup-logon" /TR "[MBACKUP_PROGRAM_FILES]publish\mbackup.exe" /DELAY 0015:00" /> <CustomAction Id="RemoveScheduledTaskLogon" Return="check" Impersonate="no" Loading @@ -106,7 +106,7 @@ Impersonate="no" Execute="deferred" Directory="TARGETDIR" ExeCommand=""[SystemFolder]SCHTASKS.EXE" /Create /RU SYSTEM /RP /NP /SC DAILY /TN "mbackup-interval" /TR "[MBACKUP_PROGRAM_FILES]publish\mbackup.exe" /ST 09:00 /DU 17:00 /RI 120 /K" /> ExeCommand=""[SystemFolder]SCHTASKS.EXE" /Create /RU BUILTIN\USERS /RP /NP /SC DAILY /TN "mbackup-interval" /TR "[MBACKUP_PROGRAM_FILES]publish\mbackup.exe" /ST 09:00 /DU 17:00 /RI 120 /K" /> <CustomAction Id="RemoveScheduledTaskInterval" Return="check" Impersonate="no" Loading operational +78 −1 Original line number Diff line number Diff line Loading @@ -226,6 +226,65 @@ vscode should at least always indent using space for F#. * current :entry: ** ** 2019-11-17 schtasks run-as user problem - try implement this: when run as system user, expand user-default-list.txt for all non-system, non-service users. (all users that can login with password.) when run as normal user, expand user-default-list.txt for current user. // not supported on windows. - try implement this: schtasks always run as current user. but don't show cmd.exe window when it runs. Could use a GUI wrapper that show in systray or have no visiable Windows Form at all. installer should not add /RU SYSTEM in this case. mbackupw.exe - problems - can I iter over all users on a system? yes. can I get their special folders as SYSTEM user? no. search: dotnet iter over all users on localhost .net - Get windows users with C# - Stack Overflow https://stackoverflow.com/questions/6033391/get-windows-users-with-c-sharp c# - Get list of local computer usernames in Windows - Stack Overflow https://stackoverflow.com/questions/5247798/get-list-of-local-computer-usernames-in-windows search: dotnet expand user's special folders search: Environment.GetFolderPath for other user c# - Get special folder for different user without credentials - Stack Overflow https://stackoverflow.com/questions/37630726/get-special-folder-for-different-user-without-credentials You could create a folder in ProgramData at install time, and then each time your application starts up it could write a file for the current user containing the path(s) to the directories and/or files in question. // In mbackup, I can skip generate mbackup-list.txt file if run as system user. And write mbackup-list.txt to both %localappdata%/mbackup/ and %programdata%/mbackup/run/ dir. This answer confirms it's not supported to get special folder for all users. There is no /etc/passwd like service in Windows. - is schtasks a per user thing? can schtasks always run as current login user? - run as BUILTIN\Users works. but it will show cmd.exe window. I can use a GUI app to hide the window. search: schtasks console application hide cmd.exe window ** 2019-11-16 how to sign my msi executable? so it doesn't show publisher unknown. Loading Loading @@ -353,7 +412,25 @@ so it doesn't show publisher unknown. how would home dir expand in SYSTEM user? I'd like task to run as currently logon user. for ONLOGON. - TODO why start menu shortcuts doesn't appear in win 10 guest? search: can schtasks always run task as current user https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/schtasks /it param Specifies to run the task only when the "run as" user (the user account under which the task runs) is logged on to the computer. This parameter has no effect on tasks that run with system permissions. where is win 10 doc? https://docs.microsoft.com/en-us/windows/win32/taskschd/schtasks // currently I use /NP to not show console window when mbackup.exe runs. // maybe I should find another way to not show console window. // don't write anything to console when run in schtasks. // --cron option. disable logging. I think cmd.exe will still appear for // console app. - TODO start menu txt file shortcuts doesn't appear in win 10 guest. start menu folder is created. but only one exe there. txt file shortcuts are not added. Loading Loading
mbackup.fsproj +1 −1 Original line number Diff line number Diff line Loading @@ -6,7 +6,7 @@ <RuntimeIdentifiers>win10-x64</RuntimeIdentifiers> <RootNamespace>Mbackup</RootNamespace> <TreatWarningsAsErrors>true</TreatWarningsAsErrors> <Version>0.4.6.0</Version> <Version>0.4.7.0</Version> </PropertyGroup> <ItemGroup> Loading
mbackup.wxs +2 −2 Original line number Diff line number Diff line Loading @@ -94,7 +94,7 @@ Impersonate="no" Execute="deferred" Directory="TARGETDIR" ExeCommand=""[SystemFolder]SCHTASKS.EXE" /Create /RU SYSTEM /RP /NP /SC ONLOGON /TN "mbackup-logon" /TR "[MBACKUP_PROGRAM_FILES]publish\mbackup.exe" /DELAY 0015:00" /> ExeCommand=""[SystemFolder]SCHTASKS.EXE" /Create /RU BUILTIN\USERS /RP /NP /SC ONLOGON /TN "mbackup-logon" /TR "[MBACKUP_PROGRAM_FILES]publish\mbackup.exe" /DELAY 0015:00" /> <CustomAction Id="RemoveScheduledTaskLogon" Return="check" Impersonate="no" Loading @@ -106,7 +106,7 @@ Impersonate="no" Execute="deferred" Directory="TARGETDIR" ExeCommand=""[SystemFolder]SCHTASKS.EXE" /Create /RU SYSTEM /RP /NP /SC DAILY /TN "mbackup-interval" /TR "[MBACKUP_PROGRAM_FILES]publish\mbackup.exe" /ST 09:00 /DU 17:00 /RI 120 /K" /> ExeCommand=""[SystemFolder]SCHTASKS.EXE" /Create /RU BUILTIN\USERS /RP /NP /SC DAILY /TN "mbackup-interval" /TR "[MBACKUP_PROGRAM_FILES]publish\mbackup.exe" /ST 09:00 /DU 17:00 /RI 120 /K" /> <CustomAction Id="RemoveScheduledTaskInterval" Return="check" Impersonate="no" Loading
operational +78 −1 Original line number Diff line number Diff line Loading @@ -226,6 +226,65 @@ vscode should at least always indent using space for F#. * current :entry: ** ** 2019-11-17 schtasks run-as user problem - try implement this: when run as system user, expand user-default-list.txt for all non-system, non-service users. (all users that can login with password.) when run as normal user, expand user-default-list.txt for current user. // not supported on windows. - try implement this: schtasks always run as current user. but don't show cmd.exe window when it runs. Could use a GUI wrapper that show in systray or have no visiable Windows Form at all. installer should not add /RU SYSTEM in this case. mbackupw.exe - problems - can I iter over all users on a system? yes. can I get their special folders as SYSTEM user? no. search: dotnet iter over all users on localhost .net - Get windows users with C# - Stack Overflow https://stackoverflow.com/questions/6033391/get-windows-users-with-c-sharp c# - Get list of local computer usernames in Windows - Stack Overflow https://stackoverflow.com/questions/5247798/get-list-of-local-computer-usernames-in-windows search: dotnet expand user's special folders search: Environment.GetFolderPath for other user c# - Get special folder for different user without credentials - Stack Overflow https://stackoverflow.com/questions/37630726/get-special-folder-for-different-user-without-credentials You could create a folder in ProgramData at install time, and then each time your application starts up it could write a file for the current user containing the path(s) to the directories and/or files in question. // In mbackup, I can skip generate mbackup-list.txt file if run as system user. And write mbackup-list.txt to both %localappdata%/mbackup/ and %programdata%/mbackup/run/ dir. This answer confirms it's not supported to get special folder for all users. There is no /etc/passwd like service in Windows. - is schtasks a per user thing? can schtasks always run as current login user? - run as BUILTIN\Users works. but it will show cmd.exe window. I can use a GUI app to hide the window. search: schtasks console application hide cmd.exe window ** 2019-11-16 how to sign my msi executable? so it doesn't show publisher unknown. Loading Loading @@ -353,7 +412,25 @@ so it doesn't show publisher unknown. how would home dir expand in SYSTEM user? I'd like task to run as currently logon user. for ONLOGON. - TODO why start menu shortcuts doesn't appear in win 10 guest? search: can schtasks always run task as current user https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/schtasks /it param Specifies to run the task only when the "run as" user (the user account under which the task runs) is logged on to the computer. This parameter has no effect on tasks that run with system permissions. where is win 10 doc? https://docs.microsoft.com/en-us/windows/win32/taskschd/schtasks // currently I use /NP to not show console window when mbackup.exe runs. // maybe I should find another way to not show console window. // don't write anything to console when run in schtasks. // --cron option. disable logging. I think cmd.exe will still appear for // console app. - TODO start menu txt file shortcuts doesn't appear in win 10 guest. start menu folder is created. but only one exe there. txt file shortcuts are not added. Loading