main

Active DirectoryTipsWindows

My Batch File Templates

robocopy-examples.jpg?fit=768%2C411

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

SCCM

Silent Install Adobe Reader 11 – msi and exe – disable update

Apps-adobe-reader-icon.png?fit=512%2C512

In this tutorial will explain how to silent install Adobe Reader version 11We will be using the MSI and an MST that is built by the Adobe Customization Kit. The script will disable auto update automatically. The command will uninstall older version of Adobe Reader and install a new version. We will use MST Transform file of adobe to make configurations. I trying to script Adobe Reader version 11.0.10 for an SCCM deployment.

Silent Install Adobe Reader.

  • Adobe Reader 11 silent install:
    • Download msi.
    • Create MST file.
    • Create cmd file
    • Execute command.

Adobe Reader 11 msi silent install.

Download msi for silent install Adobe Reader.

First download the package for adobe reader 11.0.0 :

ftp://ftp.adobe.com/pub/adobe/reader/win/11.x/11.0.00/en_US/AdbeRdr11000_en_US.exe

Second download adobe reader 11.0.10 patches :

ftp://ftp.adobe.com/pub/adobe/reader/win/11.x/11.0.20/misc/AdbeRdrUpd11010.msp

Save both on folder named “AdobeReader_11010” and unzip AdbeRdr11000_en_US.exe inside folder.

Create a MST transform.

  1. Download Adobe Customization Wizard XI from here.
  2. Install the application and launch it when done.
  3. Click on File -> Copy Package.
  4. Enter the information as below:
  • Source package – Your source of msi that we unzipped “AcroRead.msi”
  • Name of the new package “AcroRead”
  • Location for new package copied – under AdobeReader_11010\

Make any desired configuration in the menus to the left that fits your environment. We recommended :

  • In the left pane on the Personalization Options, check EULA Option: Suppress display of End User License Agreement (EULA).

On the Online Services and Features page, check the following boxes:

  • Disable product updates
  • In Adobe Reader, disable Help > Purchase Adobe Acrobat
  • Disable Product Improvement Program
  • Remove Viewing of PDF with Ads for Adobe PDF
  • Disable all Adobe online services based workflows and entry points

Click File -> Save Package.

Create the .cmd.

  • Inside folder “AdobeReader_11010”  create a text file called install.cmd
  • Copy the following command lines:
@echo silent install Adobe Reader 11.0.10

start /wait msiexec /i "%~dp0AcroRead.msi" EULA_ACCEPT=YES TRANSFORMS="AcroRead.mst" /Update "%~dp0AdbeRdrUpd11010.msp" /qn

You’ll now have the complete package that can be silent installed.

Packaging AppsTips

How to install and configure FileZilla Silently Via Batch File

filezilla-logo.png?fit=768%2C351

The following process has been tested and confirmed working with FileZilla 3.28.x and ConfigMgr / SCCM 2012 R2.

It does the following tasks:

  • Uninstalls any existing versions of FileZilla
  • Installs FileZilla for the operating systems architecture (32-bit or 64-bit)

PLEASE NOTE – If you wish to use a different version of FileZilla you will need to either, rename your installation files to match those referenced in the script or amend the script to reference the files you are trying to use.

  1. Download both the 32-bit and 64-bit versions of the EXE installation files from https://filezilla-project.org/download.php?show_all=1
  2. Create a text file called install.cmd and copy in the following information.
@echo off
cls
echo --------------------------------------------------------
echo .
echo .
echo .           Installing FileZilla - Please Wait.
echo .         (This window will close once installed)
echo .

REM Uninstall any previous version of FileZilla
if exist "%programfiles%\FileZilla FTP Client\uninstall.exe" "%programfiles%\FileZilla FTP Client\uninstall.exe" /S
if exist "%programfiles(x86)%\FileZilla FTP Client\uninstall.exe" "%programfiles(x86)%\FileZilla FTP Client\uninstall.exe" /S

REM Silent install FileZilla for 64-bit
if defined ProgramFiles(x86) "%~dp0FileZilla_3.26.2_win64-setup.exe" /S
if defined ProgramFiles(x86) exit

REM Silent install FileZilla for 32-bit
"%~dp0FileZilla_3.26.2_win32-setup.exe" /S
  1. Copy the two exe install files and install.cmd to your software package share
  2. You can now create your SCCM package or deploy the software by using install.cmd

If you wish for this to be truely silent you can delete the following lines of code from the script:

@echo off
cls
echo --------------------------------------------------------
echo .
echo .
echo .           Installing FileZilla - Please Wait.
echo .         (This window will close once installed)
echo .

 

Ref: https://www.itsupportguides.com/knowledge-base/tech-tips-tricks/how-to-install-and-configure-filezilla-silently/

Tips

How to get MSI product code or GUID with PowerShell

basic-powershell-commands-intro-670x335.png?fit=670%2C335

Save the below script as Get-MSIFileInformation.ps1 to C:\Scripts.

param(
    [parameter(Mandatory=$true)]
    [ValidateNotNullOrEmpty()]
    [System.IO.FileInfo]$Path,
  
    [parameter(Mandatory=$true)]
    [ValidateNotNullOrEmpty()]
    [ValidateSet("ProductCode", "ProductVersion", "ProductName", "Manufacturer", "ProductLanguage", "FullVersion")]
    [string]$Property
)
Process {
    try {
        # Read property from MSI database
        $WindowsInstaller = New-Object -ComObject WindowsInstaller.Installer
        $MSIDatabase = $WindowsInstaller.GetType().InvokeMember("OpenDatabase", "InvokeMethod", $null, $WindowsInstaller, @($Path.FullName, 0))
        $Query = "SELECT Value FROM Property WHERE Property = '$($Property)'"
        $View = $MSIDatabase.GetType().InvokeMember("OpenView", "InvokeMethod", $null, $MSIDatabase, ($Query))
        $View.GetType().InvokeMember("Execute", "InvokeMethod", $null, $View, $null)
        $Record = $View.GetType().InvokeMember("Fetch", "InvokeMethod", $null, $View, $null)
        $Value = $Record.GetType().InvokeMember("StringData", "GetProperty", $null, $Record, 1)
  
        # Commit database and close view
        $MSIDatabase.GetType().InvokeMember("Commit", "InvokeMethod", $null, $MSIDatabase, $null)
        $View.GetType().InvokeMember("Close", "InvokeMethod", $null, $View, $null)          
        $MSIDatabase = $null
        $View = $null
  
        # Return the value
        return $Value
    }
    catch {
        Write-Warning -Message $_.Exception.Message ; break
    }
}
End {
    # Run garbage collection and release ComObject
    [System.Runtime.Interopservices.Marshal]::ReleaseComObject($WindowsInstaller) | Out-Null
    [System.GC]::Collect()
}