Imaging OEM

1 minute read

Description:

I know these are the words SysAdmins snear at, but sometimes you have no choice if a company doesn’t bother with Volume Licensing therefore no Re-image Rights. Follow this post to generically apply a custom image to OEM computers.

To Resolve:

  1. Run a generic template script.

2018-04: Place this in your script to download and run my template script on any W10 Machine:

Log "Launching template script"
[Net.ServicePointManager]::SecurityProtocol = "Tls12, Tls11, Tls, Ssl3"

$Path = "$Env:UserProfile\Downloads" + "\Temp"
If (Test-Path $Path)
{
Remove-Item -Path $Path -Recurse -Force
New-Item -ItemType Directory -Path $Path -Force
}
Else
{
New-Item -ItemType Directory -Path $Path -Force
}

$PrivatePath = $Path + "\Private"
New-Item -ItemType Directory -Path $PrivatePath -Force
$Download = "$Path\Private\helpers.psm1"
$URI = "https://raw.githubusercontent.com/gerryw1389/master/master/gwConfiguration/Private/helpers.psm1"
$Response = Invoke-RestMethod -Method Get -Uri $URI
$Response | Out-File $Download -Encoding ASCII

$PublicPath = $Path + "\Public"
New-Item -ItemType Directory -Path $PublicPath -Force
$Download = "$Path\Public\set-template.ps1"
$URI = "https://raw.githubusercontent.com/gerryw1389/master/master/gwConfiguration/Public/Set-Template.ps1"
$Response = Invoke-RestMethod -Method Get -Uri $URI
$Response | Out-File $Download -Encoding ASCII

$Batch = "$PublicPath" + "\set-template.bat"
$String = @'
@ECHO OFF
PowerShell.exe -NoProfile ^
-Command "& {Start-Process PowerShell.exe -ArgumentList '-NoProfile -ExecutionPolicy Bypass -Command ". "%~dpn0.ps1"; Set-Template "' -Verb RunAs}"
'@
Write-Output $String | Out-File -LiteralPath $Batch -Encoding ASCII

Start-Process $Batch -Verb Runas

 

  1. Install Chocolatey:

  2. Uninstall pre-installed Office.

  3. For manual installs (outside of Chocolatey), I would do:

Write-Output "Installing Adobe Reader if not installed"
If (!(Test-Path "C:\Program Files (x86)\Adobe\Reader"))
{
Set-Location -Path "$PSScriptRoot\reader"
cmd /c "Reader.Exe /Spb"
cmd /c Pause
}
Else
{
Write-Output "Adobe Reader already installed, moving on"
}
  1. To send installed program icons to the desktop
Write-Output "Setting MS Excel Link"
$Targetfile = "C:\Program Files (x86)\Microsoft Office\root\Office16\EXCEL.EXE"
$Shortcutfile = "$Env:Userprofile\Desktop\Excel 2016.Lnk"
$Wscriptshell = New-Object -Comobject Wscript.Shell
$Shortcut = $Wscriptshell.Createshortcut($Shortcutfile)
$Shortcut.Targetpath = $Targetfile
$Shortcut.Save()

Write-Output "Setting MS Outlook Link"
$Targetfile = "C:\Program Files (x86)\Microsoft Office\root\Office16\OUTLOOK.EXE"
$Shortcutfile = "$Env:Userprofile\Desktop\Outlook 2016.Lnk"
$Wscriptshell = New-Object -Comobject Wscript.Shell
$Shortcut = $Wscriptshell.Createshortcut($Shortcutfile)
$Shortcut.Targetpath = $Targetfile
$Shortcut.Save()
  1. Other optional tasks:
    Configure IE

Send link to helpdesk

Map drives

Add printers

Many other things