windows-administration

Enable Windows 10 Developer Mode programmatically

一个人想着一个人 提交于 2019-12-18 12:24:38
问题 I know you can enable Windows 10 Developer mode interactively by going to Settings | For developers, selecting 'Developer mode' and then rebooting. Is there a way to enable this programmatically? (eg. via PowerShell or similar so that I can include it as a step in a Boxstarter script when refreshing my developer workstation) 回答1: Turns out Nickolaj Andersen has written an article which includes just such a PowerShell script.. http://www.scconfigmgr.com/2016/09/11/enable-ubuntu-in-windows-10

Enable Windows 10 Developer Mode programmatically

浪子不回头ぞ 提交于 2019-11-30 06:47:20
I know you can enable Windows 10 Developer mode interactively by going to Settings | For developers, selecting 'Developer mode' and then rebooting. Is there a way to enable this programmatically? (eg. via PowerShell or similar so that I can include it as a step in a Boxstarter script when refreshing my developer workstation) Turns out Nickolaj Andersen has written an article which includes just such a PowerShell script.. http://www.scconfigmgr.com/2016/09/11/enable-ubuntu-in-windows-10-during-osd-with-configmgr/ Here are the relevant lines extracted from his post: # Create AppModelUnlock if it

Check if the current user is administrator

拥有回忆 提交于 2019-11-26 06:31:37
问题 My application needs to run some scripts, and I must be sure that the user running them is an administrator... What is the best way of doing this using C#? 回答1: using System.Security.Principal; public static bool IsAdministrator() { using (WindowsIdentity identity = WindowsIdentity.GetCurrent()) { WindowsPrincipal principal = new WindowsPrincipal(identity); return principal.IsInRole(WindowsBuiltInRole.Administrator); } } 回答2: return new WindowsPrincipal(WindowsIdentity.GetCurrent()) .IsInRole