Add scripts for adjoin/adleave #121
This commit is contained in:
parent
4a972a6a04
commit
3782e3d78e
28
adjoin.cmd
Normal file
28
adjoin.cmd
Normal file
@ -0,0 +1,28 @@
|
||||
@echo off
|
||||
call check-for-admin
|
||||
if %ERRORLEVEL% neq 0 exit /b
|
||||
|
||||
set TOOLS=c:\tools
|
||||
set SCRIPT_SETTINGS=%TOOLS%\scripts\settings.cmd
|
||||
set COMPANY_SETTINGS=%TOOLS%\company\settings.cmd
|
||||
|
||||
echo ####### %0 #######
|
||||
|
||||
if NOT EXIST %SCRIPT_SETTINGS% (
|
||||
echo INFO: config file %SCRIPT_SETTINGS% NOT FOUND
|
||||
) else (
|
||||
call %SCRIPT_SETTINGS%
|
||||
)
|
||||
|
||||
if NOT EXIST %COMPANY_SETTINGS% (
|
||||
echo INFO: config file %COMPANY_SETTINGS% NOT FOUND
|
||||
) else (
|
||||
call %COMPANY_SETTINGS%
|
||||
)
|
||||
|
||||
echo JOINING domain ...
|
||||
echo domain=%domain%
|
||||
powershell -Command "Add-Computer -DomainName %domain% -Restart -Credential $env:UserName"
|
||||
|
||||
echo ####### %0 #######
|
||||
|
11
adleave.cmd
Normal file
11
adleave.cmd
Normal file
@ -0,0 +1,11 @@
|
||||
@echo off
|
||||
call check-for-admin
|
||||
if %ERRORLEVEL% neq 0 exit /b
|
||||
|
||||
echo ####### %0 #######
|
||||
|
||||
echo LEAVING domain ...
|
||||
powershell -Command "Remove-Computer -Restart -PassThru -UnJoinDomainCredential $env:username -Confirm:$false -Force:$true"
|
||||
|
||||
echo ####### %0 #######
|
||||
|
Loading…
Reference in New Issue
Block a user