From d61781230e9cf64a52d4130afb5abc198f724f71 Mon Sep 17 00:00:00 2001 From: Bernardo Garza Date: Fri, 30 Jul 2021 16:18:00 -0500 Subject: [PATCH 1/2] Updated the main script to no longer require admin for checking what the current status of that bit is for easier startup scripting. Updated the readme to indicate that checking the dpst state doesn't require admin. --- README.md | 4 ++-- dpst-control.ps1 | 14 +++++++------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 3bb8d3a..eaed925 100644 --- a/README.md +++ b/README.md @@ -23,11 +23,11 @@ Each command does only one thing, and there is no GUI interface. To use: 3. Enter administrator password if prompted 4. Reboot -:warning: **MUST RUN AS ADMINISTRATOR** :warning: - To check the status of DPST: * `get-status.bat` +:warning: **MUST RUN AS ADMINISTRATOR** :warning: + To disable DPST: * `disable-dpst.bat` diff --git a/dpst-control.ps1 b/dpst-control.ps1 index ab3812d..02dd8f3 100644 --- a/dpst-control.ps1 +++ b/dpst-control.ps1 @@ -127,12 +127,6 @@ If( $Debug ) { $DebugPreference = "Continue" # Enable debug output } -# This script must run as admin -If( !(RunningAsAdmin) ) { - Write-Error "Must run as Administrator!" - Exit 255 -} - # Search registry for FTC entry $ftcPath = LocateFTC -regPath ${regBase} If( $ftcPath -eq $false ) { @@ -184,11 +178,17 @@ Else { Exit 1 } Else { - Write-Output "DPST is disabled" + Write-Output "DPST is disabled" Exit 0 } } +# This script must run as admin if the value is going to be overwritten +If( !(RunningAsAdmin) ) { + Write-Error "Must run as Administrator!" + Exit 255 +} + # Write new value to registry and report results If( $ftcNew ) { From 7d1ee4ff93550862d5bf4ad0704c6e4b47731548 Mon Sep 17 00:00:00 2001 From: Bernardo Garza Date: Fri, 30 Jul 2021 16:26:15 -0500 Subject: [PATCH 2/2] Updated the documentation to better represent what commands need to be run as admin. --- README.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index eaed925..ed275a2 100644 --- a/README.md +++ b/README.md @@ -19,9 +19,10 @@ It is notably used on the Microsoft Surface line of products, as well as many ot Each command does only one thing, and there is no GUI interface. To use: 1. Download and unzip. Does not have an installer 2. Select file -2. Right-click, Select: "Run as Administrator" -3. Enter administrator password if prompted -4. Reboot +3. If you're running `get-status.bat` you don't have to run as admin, otherwise: +4. Right-click, Select: "Run as Administrator" +5. Enter administrator password if prompted +6. Reboot To check the status of DPST: * `get-status.bat`