A while ago i was trying to create a task sequence to upgrade windows to windows 10 for a bunch of our PCs. While deploying i ran into issues with the Symantec Endpoint protection's PTP feature interrupting the upgrade. Removing SEP silently within a task sequence without disabling tamper protection and\or the password is a pain so i decided to use cleanwipe unfortunately cleanwipe no longer has the -silent parameter to uninstall SEP unattended so i got creative and decided to use sendkeys to script the clicks on cleanwipe:
Create a package in sccm with the extracted cleanwipe files and ServiceUI.exe (from the MDT toolkit) and the below script:
$PSScriptRoot = ($MyInvocation.MyCommand.Path | Split-Path | Resolve-Path).ProviderPath
$BuildName = $PSScriptRoot | Split-Path -Leaf
#Start-Process -FilePath msiexec.exe -ArgumentList $arguments -Wait -PassThru
$process = Start-Process -filepath $PSScriptRoot\CleanWipe.exe
add-type -AssemblyName microsoft.VisualBasic
add-type -AssemblyName System.Windows.Forms
$app = get-process | where {$_.mainwindowtitle -like "Cleanwipe"}
$processID = 0
foreach ($a in $app) {
if ($a.id -gt $processID)
{
$processID = $a.id
}
}
start-sleep -Milliseconds 500
[Microsoft.VisualBasic.Interaction]::AppActivate($processID)
[System.Windows.Forms.SendKeys]::SendWait("{ENTER}")
[System.Windows.Forms.SendKeys]::SendWait(" ")
[System.Windows.Forms.SendKeys]::SendWait("{ENTER}")
[System.Windows.Forms.SendKeys]::SendWait(" ")
[System.Windows.Forms.SendKeys]::SendWait("{TAB}")
[System.Windows.Forms.SendKeys]::SendWait("{TAB}")
[System.Windows.Forms.SendKeys]::SendWait("{TAB}")
[System.Windows.Forms.SendKeys]::SendWait("{TAB}")
[System.Windows.Forms.SendKeys]::SendWait("{ENTER}")
[System.Windows.Forms.SendKeys]::SendWait(" ")
[System.Windows.Forms.SendKeys]::SendWait("{TAB}")
[System.Windows.Forms.SendKeys]::SendWait("{TAB}")
[System.Windows.Forms.SendKeys]::SendWait("{TAB}")
[System.Windows.Forms.SendKeys]::SendWait("{TAB}")
[System.Windows.Forms.SendKeys]::SendWait("{ENTER}")
Create a task sequence and use the below command line to run the script in user session instead of 'in a system' context:
Create a package in sccm with the extracted cleanwipe files and ServiceUI.exe (from the MDT toolkit) and the below script:
$PSScriptRoot = ($MyInvocation.MyCommand.Path | Split-Path | Resolve-Path).ProviderPath
$BuildName = $PSScriptRoot | Split-Path -Leaf
#Start-Process -FilePath msiexec.exe -ArgumentList $arguments -Wait -PassThru
$process = Start-Process -filepath $PSScriptRoot\CleanWipe.exe
add-type -AssemblyName microsoft.VisualBasic
add-type -AssemblyName System.Windows.Forms
$app = get-process | where {$_.mainwindowtitle -like "Cleanwipe"}
$processID = 0
foreach ($a in $app) {
if ($a.id -gt $processID)
{
$processID = $a.id
}
}
start-sleep -Milliseconds 500
[Microsoft.VisualBasic.Interaction]::AppActivate($processID)
[System.Windows.Forms.SendKeys]::SendWait("{ENTER}")
[System.Windows.Forms.SendKeys]::SendWait(" ")
[System.Windows.Forms.SendKeys]::SendWait("{ENTER}")
[System.Windows.Forms.SendKeys]::SendWait(" ")
[System.Windows.Forms.SendKeys]::SendWait("{TAB}")
[System.Windows.Forms.SendKeys]::SendWait("{TAB}")
[System.Windows.Forms.SendKeys]::SendWait("{TAB}")
[System.Windows.Forms.SendKeys]::SendWait("{TAB}")
[System.Windows.Forms.SendKeys]::SendWait("{ENTER}")
[System.Windows.Forms.SendKeys]::SendWait(" ")
[System.Windows.Forms.SendKeys]::SendWait("{TAB}")
[System.Windows.Forms.SendKeys]::SendWait("{TAB}")
[System.Windows.Forms.SendKeys]::SendWait("{TAB}")
[System.Windows.Forms.SendKeys]::SendWait("{TAB}")
[System.Windows.Forms.SendKeys]::SendWait("{ENTER}")
Create a task sequence and use the below command line to run the script in user session instead of 'in a system' context:
Are you running this from a distribution point or downloading the content first? Cleanwipe needs to be run from a local hard drive.
ReplyDeleteShould run fine from the DP.
ReplyDelete