Install Notepad++ with GPO

For a different company I needed to install Notepad++ on some systems.

Created AD group. Created a Share. Give rights to the AD group.
In the ad Group place the computers.

Created GPO and rights to the AD group only.
Added the script in startup scripts in the computer configuration.

@echo off
REM #########################################
REM ##### Created by Daag van der Meer #####
REM ##### Blog.van-daag.nl             #####
REM ##### Filename NPPInstall.cmd      #####
REM #########################################
PING 1.1.1.1 -n 1 -w 900 >NUL

SET LOGLOC=%Systemdrive%\logs


REM ############### Create Log Dir ###################
mkdir %LOGLOC%
attrib +s +h %Systemdrive%\logs
GOTO INSTALL

:INSTALL
REM ######## Check NPP Installed #############
set Logfile=%LOGLOC%\NPPfile.log
if not exist "%Logfile%" (
echo NPP is Installed on %date% at %time% >> %LogFile%
GOTO NPPSTART)

GOTO END

:NPPSTART

if exist "%programfiles%\Notepad++\uninstall.exe" GOTO END

if exist "%programfiles(x86)%\ Notepad++\uninstall.exe" GOTO END

start /wait \\<SERVER>\<SHARE>\npp.7.4.2.Installer.exe /S



:END

 

Create a reboot popup with Landesk

The problem what I had with Landesk, when software is installed I want to inform the user to reboot. This is not configured in Landesk.

I made this script that use landesk client on the system to create a popup for a reboot.

@echo off
cls
echo --------------------------------------------------------
echo .
echo .
echo .                     Reboot
echo .         Window will close once installed

If "%PROCESSOR_ARCHITECTURE%" == "AMD64" GOTO X64
IF "%PROCESSOR_ARCHITECTURE%" == "x86" GOTO x86

GOTO EXIT


:: Wait for 20 seconds
ping -n 20 127.0.0.1 > NUL

:x86


REM Run Reboot
"C:\Program Files\LANDesk\LDClient\ldReboot.exe"


GOTO EXIT



:X64

REM Run Reboot
"C:\Program Files (x86)\LANDesk\LDClient\ldReboot.exe"


GOTO EXIT

:EXIT
REM Return exit code to SCCM
exit /B %EXIT_CODE%

Add this script to landesk as a program and you can use it every time when you need to inform the user to reboot.

Netsend with PStools

I created this script to send a message to all of our managed systems if there are problems and email is not working.

Here is the overview of the files what you need.

The computer.txt is the list of all hostnames where you want to send message.

PsExec you can download at Microsoft.

readme.txt is a short manual how to use it for other people

The startmij.cmd file below you can only run when the files are local on the system with UAC enabled and tested only with Windows 7. And you need to have local admin rights on all of the domain computers.

@echo off
REM ########################################################
REM ## Created by Daag van der Meer                     ##
REM ########################################################

REM ###########################################################
REM ## CHECKING FOR ADMIN                                    ##
REM ###########################################################
>nul 2>&1 "%SYSTEMROOT%\system32\cacls.exe" "%SYSTEMROOT%\system32\config\system"
REM --> If error flag set, we do not have admin.
if '%errorlevel%' NEQ '0' (
    echo Requesting administrative privileges...
    goto UACPrompt
) else ( goto gotAdmin )
:UACPrompt
    echo Set UAC = CreateObject^("Shell.Application"^) > "%temp%\getadmin.vbs"
    echo UAC.ShellExecute "%~s0", "", "", "runas", 1 >> "%temp%\getadmin.vbs"
    "%temp%\getadmin.vbs"
    exit /B
:gotAdmin
    if exist "%temp%\getadmin.vbs" ( del "%temp%\getadmin.vbs" )
    pushd "%CD%"
    CD /D "%~dp0"
REM ###########################################################
REM ## End Checking for ADMIN                                ##
REM ###########################################################

:START
cls
Echo ###########################################################
Echo ## Hiermee stuur je een popupmelding naar elke pc die    ##
echo ## in computers.txt vermeld staat.                       ##
echo ###########################################################
echo.
Echo Voer de tekst in wat je wilt versturen naar alle pc's.
echo.
set /p text=Je tekst:
cls
set /p tijd=Hoeveel seconden moet dit bericht blijven staan:
cls
echo Uw ingevoerde tekst:
echo %text%
echo.
echo Tijdweergave van dit bericht in secondes
echo %tijd%
echo.
set/p KEUZE=Klopt dit? (J)a, N(ee)
if "%KEUZE%"=="j" goto STUURMSG
if "%KEUZE%"=="J" goto STUURMSG
if "%KEUZE%"=="n" goto START
if "%KEUZE%"=="N" goto START

:STUURMSG
@echo on
PsExec.exe -n 20 @computers.txt msg * /time:%tijd% %text%

Install iTunes with Landesk

At this moment I have rights for Landesk. Not optimal but I can add software and send it to systems what I manage.

Here is a script that I use to install Itunes.

@echo off
cls
echo --------------------------------------------------------
echo .
echo .
echo .      Installing iTunes 12.5.4.42 x64
echo .         Window will close once installed

If "%PROCESSOR_ARCHITECTURE%" == "AMD64" GOTO X64
IF "%PROCESSOR_ARCHITECTURE%" == "x86" GOTO x86

GOTO EXIT


:: Wait for 20 seconds
ping -n 20 127.0.0.1 > NUL

:x86
REM Copy Installer
REM Installer is only X64

GOTO EXIT



:X64
REM Copy Installer
Copy "\\<SERVER>\iTunes 12.5.4.42 x64\AppleApplicationSupport.msi" "C:\Logs\"
Copy "\\<SERVER>\iTunes 12.5.4.42 x64\AppleApplicationSupport64.msi" "C:\Logs\"
Copy "\\<SERVER>\iTunes 12.5.4.42 x64\AppleMobileDeviceSupport6464.msi" "C:\Logs\"
Copy "\\<SERVER>\iTunes 12.5.4.42 x64\AppleSoftwareUpdate.msi" "C:\Logs\"
Copy "\\<SERVER>\iTunes 12.5.4.42 x64\Bonjour64.msi" "C:\Logs\"
Copy "\\<SERVER>\iTunes 12.5.4.42 x64\iTunes6464.msi" "C:\Logs\"

REM Run Installer
MSIEXEC.EXE /I "C:\Logs\AppleApplicationSupport.msi" /QN /norestart REBOOT=ReallySuppress
MSIEXEC.EXE /I "C:\Logs\AppleApplicationSupport64.msi" /QN /norestart REBOOT=ReallySuppress
MSIEXEC.EXE /I "C:\Logs\AppleMobileDeviceSupport6464.msi" /QN /norestart REBOOT=ReallySuppress
MSIEXEC.EXE /I "C:\Logs\AppleSoftwareUpdate.msi" /QN /norestart REBOOT=ReallySuppress
MSIEXEC.EXE /I "C:\Logs\Bonjour64.msi" /QN /norestart REBOOT=ReallySuppress
MSIEXEC.EXE /I "C:\Logs\iTunes6464.msi" /QN /norestart REBOOT=ReallySuppress

:: Wait for 20 seconds
ping -n 20 127.0.0.1 > NUL

REM Delete Installer
Del "C:\Logs\AppleApplicationSupport.msi"
Del "C:\Logs\AppleApplicationSupport64.msi"
Del "C:\Logs\AppleMobileDeviceSupport6464.msi"
Del "C:\Logs\AppleSoftwareUpdate.msi"
Del "C:\Logs\Bonjour64.msi"
Del "C:\Logs\iTunes6464.msi"

GOTO EXIT

:EXIT
REM Return exit code to Landesk
exit /B %EXIT_CODE%

 

Remove Java and install Latest Version

At the company where I work we don’t have full domain rights. There is no SCCM Server. There is an other software deploy program that we only have rights to send it to computers, not to create packages. So I create my own scripts to update computers.

This script I use to update Java on all computers. Windows 7 and Windows 10.

@echo off
REM #########################################
REM ##### Created by Daag van der Meer  #####
REM ##### http://blog.van-daag.nl       #####
REM ##### Filename InstallJava.cmd      #####
REM #########################################
PING 1.1.1.1 -n 1 -w 900 >NUL

SET JavaFile=<JAVAFilename.msi>
SET JavaLoc=\\<Java MSI Location\Java\Update
SET LOGLOC=%Systemdrive%\logs

REM ############### Create Log Dir ###################
mkdir %LOGLOC%
attrib +s +h %Systemdrive%\logs
Goto INSTALL

:INSTALL
REM ######## Check Java Installed #############
set Logfile=%LOGLOC%\%JavaFile%.log
if not exist "%Logfile%" (
echo Java is Installed on %date% at %time% >> %LogFile%
GOTO JAVASTART)

GOTO END

:JAVASTART
REM ###### Uninstall All Java versions ####
Echo Removing All Java Versions
wmic product where "name like 'Java%%'" call uninstall /nointeractive

REM Java Silent Install version 8111 (replace with your java version downloaded)
Echo Installing Java
copy %JavaLoc%\%JavaFile% %LOGLOC%
start /wait msiexec.exe /i %LOGLOC%\%JavaFile% JU=0 JAVAUPDATE=0 AUTOUPDATECHECK=0 RebootYesNo=No
del %LOGLOC%\%JavaFile%

REM Disable Auto Update
echo Disable Auto Updates
reg delete "HKLM\SOFTWARE\JavaSoft\Java Update\Policy\jucheck" /v "UpdateSchedule" /f
reg delete "HKLM\SOFTWARE\JavaSoft\Java Update\Policy\jucheck" /v "UpdateMin" /f
reg add "HKLM\SOFTWARE\JavaSoft\Java Update\Policy" /v EnableJavaUpdate /t REG_DWORD /d 00000000 /f
reg add "HKLM\SOFTWARE\JavaSoft\Java Update\Policy" /v EnableAutoUpdateCheck /t REG_DWORD /d 00000000 /f
reg add "HKCU\SOFTWARE\JavaSoft\Java Update\Policy" /v EnableJavaUpdate /t REG_DWORD /d 00000000 /f

reg delete "HKLM\SOFTWARE\Wow6432Node\JavaSoft\Java Update\Policy\jucheck" /v "UpdateSchedule" /f
reg delete "HKLM\SOFTWARE\Wow6432Node\JavaSoft\Java Update\Policy\jucheck" /v "UpdateMin" /f
reg add "HKLM\SOFTWARE\Wow6432Node\JavaSoft\Java Update\Policy" /v EnableJavaUpdate /t REG_DWORD /d 00000000 /f
reg add "HKLM\SOFTWARE\Wow6432Node\JavaSoft\Java Update\Policy" /v EnableAutoUpdateCheck /t REG_DWORD /d 00000000 /f

Goto END
:NO
del %LOGLOC%\%JavaFile%.log

:END

Add this script to the machine policy.

 

When a computer has the login screen this batch file runs and removes / installs Java.