main

Active DirectoryTipsWindows

My Batch File Templates

Spread the love

This script silently installs Sophos but it can be amended to install apps and run various commands.

@ECHO OFF
CLS
ECHO 1.VDI Install
ECHO 2.Physical PC Install
ECHO 3.Mac Client Download
ECHO 4.Reboot This Machine
ECHO 5.Log off This Machine
ECHO.

CHOICE /C 12345 /M "Select your option:"

:: Note - list ERRORLEVELS in decreasing order
IF ERRORLEVEL 5 GOTO Logoff
IF ERRORLEVEL 4 GOTO Reboot
IF ERRORLEVEL 3 GOTO Mac
IF ERRORLEVEL 2 GOTO Physical
IF ERRORLEVEL 1 GOTO VDI

:VDI
ECHO

net use y: "\\ServerPath\SCCM_Content_Source$\Applications\MSI\BPR_Sophos_All"

cd Y:\

VDI.exe -q

GOTO End

:Physical
ECHO

net use y: "\\ServerPath\SCCM_Content_Source$\Applications\MSI\BPR_Sophos_All"

cd Y:\

Desktop.exe -q

GOTO End

:Mac
ECHO

xcopy "\\ServerPath\SCCM_Content_Source$\Applications\MSI\BPR_Sophos_All\Mac.zip" "C:\Users\%username%\Downloads" /y

GOTO End

:Reboot
ECHO

shutdown -t 0 -r -f

GOTO End

:Logoff
ECHO 

shutdown -l -f

GOTO End

:End

 

The below script will copy data from one location to another, just add your UNC path.

Robocopy \\CurrentLocation \\Destination\ /mir /copyall

Leave a Reply

%d bloggers like this: