Yes, it's a start up script.

My script is not signed.  Our execution policy is set by GPO to "Allow local 
scripts and remote signed scripts."
Even if I pre-download the script file to the local machine, it still doesn't 
run successfully.  The same with SCCM, with the download and execute 
advertisement.

I'll test it again with the execution policy GPO set to "Allow all scripts".

Jerry Lai
Systems Engineer, Desktop Management
Herbert Smith Freehills

T  +61 3 9288 1780  M  +61 4198 9461  F  +61 3 9288 1567
www.herbertsmithfreehills.com<http://www.herbertsmithfreehills.com/>
linkedin.com/in/JerryLaiHSF<http://www.linkedin.com/in/jerrylaihsf>

From: listsad...@lists.myitforum.com [mailto:listsad...@lists.myitforum.com] On 
Behalf Of Joe Pochedley
Sent: Tuesday, 13 January 2015 11:20 PM
To: scripting@lists.myitforum.com
Subject: [scripting] RE: Powershell - Uninstall Microsoft Updates

Since you state the script runs OK from an interactive session...   Does the 
script run at all during startup?

My first thought is Execution Policy.   You mentioned adding the script to 
computer logon (as opposed to user logon), which leads me to think the script 
is running under the SYSTEM context.... Is your script signed?   If not, do you 
have the machine's execution policy set to allow unsigned scripts?

JP

From: listsad...@lists.myitforum.com<mailto:listsad...@lists.myitforum.com> 
[mailto:listsad...@lists.myitforum.com] On Behalf Of Lai, Jerry
Sent: Tuesday, January 13, 2015 5:07 AM
To: scripting@lists.myitforum.com<mailto:scripting@lists.myitforum.com>
Subject: [scripting] RE: Powershell - Uninstall Microsoft Updates

Trevor's script will remove all hotfixes, I just want to remove the ones I have 
listed in the array.

$PatchList = 
@("KB2553154","KB2899519","KB2910902","KB3008923","KB3012176","KB3013126")


Jerry Lai
Systems Engineer, Desktop Management
Herbert Smith Freehills

T  +61 3 9288 1780  M  +61 4198 9461  F  +61 3 9288 1567
www.herbertsmithfreehills.com<http://www.herbertsmithfreehills.com/>
linkedin.com/in/JerryLaiHSF<http://www.linkedin.com/in/jerrylaihsf>

From: listsad...@lists.myitforum.com<mailto:listsad...@lists.myitforum.com> 
[mailto:listsad...@lists.myitforum.com] On Behalf Of E.J. Cramer
Sent: Tuesday, 13 January 2015 8:42 PM
To: scripting@lists.myitforum.com<mailto:scripting@lists.myitforum.com>
Subject: [scripting] RE: Powershell - Uninstall Microsoft Updates

I use this one to deinstall hotfixes.
Perhaps its of use for you.


#  Author: Trevor Sullivan
#    Date: 5/25/11
# Purpose: Uninstall all software updates
#   Notes: wusa.exe kicks off asynchronously

# Get a list of all installed hotfixes
$PatchList = Get-Hotfix




# Iterate over list of hotfixes
foreach ($Patch in $PatchList)
{
    # Write-Host $Patch.HotfixId

    # If the HotfixID property contains any text, remove it (some do, some 
don't)
    $KBNumber = $Patch.HotfixId.Replace("KB", "");

    # Write-Host $KBNumber

    # Build our command line for removing the update
    $RemovalCommand = "wusa.exe /uninstall /kb:$KBNumber /quiet /log 
/norestart";
    Write-Host ("Removing update with command: " + $RemovalCommand);

    # Invoke the command we built above
    Invoke-Expression -Command $RemovalCommand;

    # Wait for wusa.exe to finish and exit (wusa.exe actually leverages
    # TrustedInstaller.exe, so you won't see much activity within the wusa 
process)
    while (@(Get-Process wusa -ErrorAction SilentlyContinue).Count -ne 0)
    {
        Start-Sleep 1
        Write-Host "Waiting for update removal to finish ..."
    }
}



From: listsad...@lists.myitforum.com<mailto:listsad...@lists.myitforum.com> 
[mailto:listsad...@lists.myitforum.com] On Behalf Of Lai, Jerry
Sent: dinsdag 13 januari 2015 10:37
To: scripting@lists.myitforum.com<mailto:scripting@lists.myitforum.com>
Subject: [scripting] Powershell - Uninstall Microsoft Updates

I have a PS script that when I launch interactively/manually, it runs perfectly 
fine from the NETLOGON share.  But When I add it into the GPO computer 
logon/start up script, it doesn't work??

Do I need to some services started before I can run this PS script to uninstall 
MS Updates?

Thanks in advanced,
Jerry

Jerry Lai
Systems Engineer, Desktop Management
Herbert Smith Freehills

T  +61 3 9288 1780  M  +61 4198 9461  F  +61 3 9288 1567
www.herbertsmithfreehills.com<http://www.herbertsmithfreehills.com/>
linkedin.com/in/JerryLaiHSF<http://www.linkedin.com/in/jerrylaihsf>


Herbert Smith Freehills LLP and its subsidiaries and Herbert Smith Freehills, 
an Australian Partnership, are separate member firms of the international legal 
practice known as Herbert Smith Freehills.

This message is confidential and may be covered by legal professional 
privilege. If you are not the intended recipient you must not disclose or use 
the information contained in it. If you have received this email in error 
please notify us immediately by return email or by calling our main switchboard 
on +612 9225 5000 and delete the email.


Further information is available from 
www.herbertsmithfreehills.com<http://www.herbertsmithfreehills.com/>.

________________________________

AMC Disclaimer : 
http://www.amc.nl/disclaimer<http://scanmail.trustwave.com/?c=4500&d=94211C8QV8PAzX_pKAr0XMpUGhrxA9b0mN-2GjAtHQ&u=http%3a%2f%2fwww%2eamc%2enl%2fdisclaimer>

________________________________






Reply via email to