-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.bat
More file actions
29 lines (23 loc) · 901 Bytes
/
setup.bat
File metadata and controls
29 lines (23 loc) · 901 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
@echo off
cls
SET CURRENTDIR=%~dp0
SET CMD="& '%CURRENTDIR%Modules\Installer\Install-FindAccountLockout.ps1'"
SET SCRIPT="%CURRENTDIR%Modules\Installer\Install-FindAccountLockout.ps1"
::First we need to verify that the installer was run with admin rights.
::Try to create a test directory inside of the Windows directory (which requires admin rights)
set TESTPATH=%WINDIR%\test_local_admin
rd "%TESTPATH%" > nul 2> nul
md "%TESTPATH%" > nul 2> nul
::Determine whether an error was returned (which would indicate a lack of admin rights)
if [%errorlevel%]==[0] set isadmin=true
if not [%errorlevel%]==[0] set isadmin=false
::Cleanup the test folder
rd "%TESTPATH%" > nul 2> nul
::Run the installer if we have admin rights
if [%isadmin%]==[true] (
powershell -ExecutionPolicy Bypass -NoProfile -Command %CMD%
)
if not [%isadmin%]==[true] (
echo Installation failed. User IS NOT admin.
)
pause