Skip to main content

Removing password protected SEP unattended during a task sequence.

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:

 

Comments

  1. Are you running this from a distribution point or downloading the content first? Cleanwipe needs to be run from a local hard drive.

    ReplyDelete
  2. Should run fine from the DP.

    ReplyDelete

Post a Comment

Popular posts from this blog

Removing corporate wireless restrictions completely : "The policies of your network prevent the creation of ad hoc (computer-to-computer) networks. For more information, contact your system administrator."

So i was recently tasked with removing wireless restrictions from a VP's windows 7 laptop that some infrastructure company had placed while contracted with our network, since he needed to enable setting up of adhoc connections on his laptop and he always got

"The policies of your network prevent the creation of ad hoc (computer-to-computer) networks. For more information, contact your system administrator."


A little bit of probing revealed that adhoc and peer to peer connections were blocked as evidenced by the the command 

netsh wlan show filter on an  elevated command prompt revealed that adhoc network type was blocked by group policy:

I removed the restrictions by:

1: open services.msc as administrator, scroll down to WLAN AutoConfig:

To Unlock Windows Update locked due to group policy.

To Unlock Windows Update locked due to group policy.




Open gpedit.msc and browse to the location /Computer Configuration/Administrative Templates/System/Internet Communication Management/Internet Communication Settings and double click "turn off access to all windows update features" and set it to disabled.

Migrating Outlook Profile to Office 365

We had a migration from Hosted Exchange to Office 365 and i was tasked with automating the local Outloook profile migration for Users:

I Created a GUI utility using powershell which would allow users to create an Office365 Profile and set it as default, I prepared PRF files for each version of office and an autodiscover.xml to be used for local autodiscover and uploaded them to a hosted site:

The PRF file to set settings for Office 365 are hard to find: i used the below entries:


;AutomaticallygeneratedPRFfilefromtheMicrosoftOfficeCustomizationandInstallationWizard;**************************************************************;Section1-ProfileDefaults;**************************************************************[General]Custom=1ProfileName=%UserName%-O365DefaultProfile=YesOverwriteProfile=YesModifyDefaultProfileIfPresent=false;**************************************************************;Section2-ServicesinProfile;**************************************************************[Service…