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%

OSD – BIOS upgrade during OS Deployment in MDT/ConfigMgr by Mikael Nystrom

Source: deploymentbunny.com

Changed the script for my enviroment

Function Import-SMSTSENV{
    try
    {
        $tsenv = New-Object -COMObject Microsoft.SMS.TSEnvironment
        Write-Output "$ScriptName - tsenv is $tsenv "
        $MDTIntegration = "YES"
         
        #$tsenv.GetVariables() | % { Write-Output "$ScriptName - $_ = $($tsenv.Value($_))" }
    }
    catch
    {
        Write-Output "$ScriptName - Unable to load Microsoft.SMS.TSEnvironment"
        Write-Output "$ScriptName - Running in standalonemode"
        $MDTIntegration = "NO"
    }
    Finally
    {
    if ($MDTIntegration -eq "YES"){
        $Logpath = $tsenv.Value("LogPath")
        $LogFile = $Logpath + "\" + "$ScriptName.log"
 
    }
    Else{
        $Logpath = $env:TEMP
        $LogFile = $Logpath + "\" + "$ScriptName.log"
    }
    }
}
Function Start-Logging{
    start-transcript -path $LogFile -Force
}
Function Stop-Logging{
    Stop-Transcript
}
Function Invoke-Exe{
    [CmdletBinding(SupportsShouldProcess=$true)]
  
    param(
        [parameter(mandatory=$true,position=0)]
        [ValidateNotNullOrEmpty()]
        [string]
        $Executable,
  
        [parameter(mandatory=$false,position=1)]
        [string]
        $Arguments
    )
  
    if($Arguments -eq "")
    {
        Write-Verbose "Running $ReturnFromEXE = Start-Process -FilePath $Executable -ArgumentList $Arguments -NoNewWindow -Wait -Passthru"
        $ReturnFromEXE = Start-Process -FilePath $Executable -NoNewWindow -Wait -Passthru
    }else{
        Write-Verbose "Running $ReturnFromEXE = Start-Process -FilePath $Executable -ArgumentList $Arguments -NoNewWindow -Wait -Passthru"
        $ReturnFromEXE = Start-Process -FilePath $Executable -ArgumentList $Arguments -NoNewWindow -Wait -Passthru
    }
    Write-Verbose "Returncode is $($ReturnFromEXE.ExitCode)"
    Return $ReturnFromEXE.ExitCode
}
 
# Set vars
$SCRIPTDIR = split-path -parent $MyInvocation.MyCommand.Path
$SCRIPTNAME = split-path -leaf $MyInvocation.MyCommand.Path
$SOURCEROOT = "$SCRIPTDIR\Source"
$SettingsFile = $SCRIPTDIR + "\" + $SettingsName
$LANG = (Get-Culture).Name
$OSV = $Null
$ARCHITECTURE = $env:PROCESSOR_ARCHITECTURE
 
#Try to Import SMSTSEnv
. Import-SMSTSENV
 
# Set more vars
$computerSystem = Get-CimInstance CIM_ComputerSystem
$Make = $tsenv.Value("Make")
$Model = $computerSystem.Model
$ModelAlias = $tsenv.Value("ModelAlias")
$MakeAlias = $tsenv.Value("MakeAlias")
 
#Start Transcript Logging
. Start-Logging
 
#Output base info
Write-Output ""
Write-Output "$ScriptName - ScriptDir: $ScriptDir"
Write-Output "$ScriptName - SourceRoot: $SOURCEROOT"
Write-Output "$ScriptName - ScriptName: $ScriptName"
Write-Output "$ScriptName - Current Culture: $LANG"
Write-Output "$ScriptName - Integration with MDT(LTI/ZTI): $MDTIntegration"
Write-Output "$ScriptName - Log: $LogFile"
Write-Output "$ScriptName - Model (win32_computersystem): $((Get-WmiObject Win32_ComputerSystem).model)"
Write-Output "$ScriptName - Name (Win32_ComputerSystemProduct): $((Get-WmiObject Win32_ComputerSystemProduct).Name)"
Write-Output "$ScriptName - Version (Win32_ComputerSystemProduct): $((Get-WmiObject Win32_ComputerSystemProduct).Version)"
Write-Output "$ScriptName - Model (from TSENV): $Model"
Write-Output "$ScriptName - ModelAlias (from TSENV): $ModelAlias"
 
#Check Model
if($((Get-WmiObject Win32_ComputerSystem).model) -eq 'HP EliteBook 8560w'){
    Write-Output "Model is $((Get-WmiObject Win32_ComputerSystem).model)"
    Write-Output "Checking BIOS Version"
    Write-Output "Version is $((Get-WmiObject Win32_Bios).SMBIOSBIOSVersion)"
    if($((Get-WmiObject Win32_Bios).SMBIOSBIOSVersion) -ne '68SVD Ver. F.50'){
        Write-Output "Needs upgrade"
        $Exe = 'hpqflash.exe'
        $Location = "$SCRIPTDIR\Source\HP EliteBook 8560w"
        $Executable = $Location + "\" + $exe
        Set-Location -Path $Location
        Invoke-Exe -Executable "$Executable" -Arguments "/s /p LCadmin1.bin" -Verbose
    }
    else
    {
        Write-Output "No Need to upgrade"
    }
}
if($((Get-WmiObject Win32_ComputerSystem).model) -eq 'HP ProBook 6570b'){
    Write-Output "Model is $((Get-WmiObject Win32_ComputerSystem).model)"
    Write-Output "Checking BIOS Version"
    Write-Output "Version is $((Get-WmiObject Win32_Bios).SMBIOSBIOSVersion)"
    if($((Get-WmiObject Win32_Bios).SMBIOSBIOSVersion) -Like '*ICE*'){
        if($((Get-WmiObject Win32_Bios).SMBIOSBIOSVersion) -ne '68ICE Ver. F.62'){
            Write-Output "Needs upgrade"
            $Exe = 'hpqflash.exe'
            $Location = "$SCRIPTDIR\Source\HP ProBook 6570b"
            $Executable = $Location + "\" + $exe
            Set-Location -Path $Location
            Invoke-Exe -Executable "$Executable" -Arguments "/s /f 68ICE.cab" -Verbose
        }
        else
        {
            Write-Output "No Need to upgrade"
        }
    }
    if($((Get-WmiObject Win32_Bios).SMBIOSBIOSVersion) -Like '*ICF*'){
        if($((Get-WmiObject Win32_Bios).SMBIOSBIOSVersion) -ne '68ICF Ver. F.62'){
            Write-Output "Needs upgrade"
            $Exe = 'hpqflash.exe'
            $Location = "$SCRIPTDIR\Source\HP ProBook 6570b"
            $Executable = $Location + "\" + $exe
            Set-Location -Path $Location
            Invoke-Exe -Executable "$Executable" -Arguments "/s /f 68ICF.cab" -Verbose
        }
        else
        {
            Write-Output "No Need to upgrade"
        }
    }
    }
   
   if($((Get-WmiObject Win32_ComputerSystem).model) -eq 'Latitude 7480'){
    Write-Output "Model is $((Get-WmiObject Win32_ComputerSystem).model)"
    Write-Output "Checking BIOS Version"
    Write-Output "Version is $((Get-WmiObject Win32_Bios).SMBIOSBIOSVersion)"
    if($((Get-WmiObject Win32_Bios).SMBIOSBIOSVersion) -ne '1.2.9'){
        Write-Output "Needs upgrade"
        $Exe = 'Latitude_7x80_1.2.9.exe'
        $Location = "$SCRIPTDIR\Source\Latitude 7480"
        $Executable = $Location + "\" + $exe
        Set-Location -Path $Location
        Invoke-Exe -Executable "$Executable" -Arguments "/s /p=Password" -Verbose
    }
    else
    {
        Write-Output "No Need to upgrade"
    }
}

   if($((Get-WmiObject Win32_ComputerSystem).model) -eq 'Latitude E7470'){
    Write-Output "Model is $((Get-WmiObject Win32_ComputerSystem).model)"
    Write-Output "Checking BIOS Version"
    Write-Output "Version is $((Get-WmiObject Win32_Bios).SMBIOSBIOSVersion)"
    if($((Get-WmiObject Win32_Bios).SMBIOSBIOSVersion) -ne '1.12.3'){
        Write-Output "Needs upgrade"
        $Exe = 'Latitude_E7x70_1.12.3.exe'
        $Location = "$SCRIPTDIR\Source\Latitude E7470"
        $Executable = $Location + "\" + $exe
        Set-Location -Path $Location
        Invoke-Exe -Executable "$Executable" -Arguments "/s /p=Password" -Verbose
    }
    else
    {
        Write-Output "No Need to upgrade"
    }
}


if($((Get-WmiObject Win32_ComputerSystem).model) -eq 'HP Compaq dc7900 Small Form Factor'){
    Write-Output "Model is $((Get-WmiObject Win32_ComputerSystem).model)"
    Write-Output "Checking BIOS Version"
    Write-Output "Version is $((Get-WmiObject Win32_Bios).SMBIOSBIOSVersion)"
    if($((Get-WmiObject Win32_Bios).SMBIOSBIOSVersion) -ne '786G1 v01.27'){
        Write-Output "Needs upgrade"
        $Exe = 'hpqflash.exe'
        $Location = "$SCRIPTDIR\Source\HP Compaq dc7900 Small Form Factor\HPQFlash"
        $Executable = $Location + "\" + $exe
        $SourceFile = $Location + "\" + "Password01.bin"
        $Destination = $env:TEMP
        $DestinationFile = $Destination + "\" + "Password01.bin"
        Copy-Item -Path $SourceFile -Destination $DestinationFile -Force -Verbose 
        Set-Location -Path $Location
        Invoke-Exe -Executable $Executable -Arguments "/s /p $DestinationFile"
    }
    else
    {
        Write-Output "No Need to upgrade"
    }
}
 
#Stop Logging
. Stop-Logging

This is how it is in MDT.

This is the folder structure

Policy Windows 10 – Mobile hotspot

How to disable the Mobile hotspot feature in Windows 10 1607

Using GPO, you can disable Mobile Hotspot in the UI by settings the GPO setting Prohibit use of Internet Connection sharing on your DNS domain network to Enabled. This settings is located under Computer configuration > (Policies) > Administrative templates > Network > Network Connections.

Task scheduler send email

Open Task Scheduler
Right Click Create New Task

Go to Tab Actions and click on New

Now enter powershell.exe under Program/scripts

Add argument > point this to the powershell script, eg C:\scripts\email.ps1

now the very simple powershell script: email.sp1

Send-MailMessage -to <recipient email address> -Subject "Backup Success" -body "The server backup job on server1 completed successfully" -smtpserver <your mail server> -from <sender email addreess>

 

Windows 10 WSUS Upgrade Issues File Not Found

I had problems with updating my system to 1607 version.
Recieved error message File not found.

Found this website with solution
https://social.technet.microsoft.com/Forums/office/en-US/d7dbb851-4e3a-41d9-9072-1f16d7b1bc1e/fix-domain-windows-10-wsus-upgrade-issues-file-not-found?forum=winserverwsus

We were having an issue with the Windows 10 upgrade MS recently released to WSUS server on our domain. To put a long story short the issue is in IIS and NOT WSUS per say. After some testing it turns out IIS was not serving the .esd file (this is the main update file) due to the mime type not being set. To rectify the issue:

under IIS Admin->WSUS Administration->Content-> Click on “Mime Types”-> Add

File Mame Extention:  = .esd

MIME type:     application/vnd.ms-cab-compressed

If you have already tried to pull the W10 update you may need to clear your SoftwareDistribution Download Cache under the Windows Dir and clear out the hidden $WINDOWS.~BT

EDIT:

The actual mime type for esd, accordion to http://www.filesuffix.com/en/extension/esd, is “application/octet-stream”.