SCCM – Application Stuck or Stalls on Installing or Downloading

email me

From time to time, SCCM just isn’t going to cooperate with you. When running published applications from the Software Center, you may notice the apps get stuck at Downloading or Installing (return code 0x80091007 (-2146889721). This happens because the machine rebooted before the SCCM agent can finish updating all the WMI classes (or something has happened to WMI or the content), but after the actual advertisement is completed. The Root/ccm/clientsdk:ccm_program class has not completely updated, resulting in your application falling into limbo. Not great. Do the following to resolve the issue and prevent it from happening again. Make sure you also review Notes at the bottom.

#1 – Return Published Applications – Note the ADV IDs of apps having problems
gwmi -Namespace root/ccm/policy/machine/actualconfig -Class ccm_softwaredistribution

* if you’d like to output to notepad for easier reading:

gwmi -Namespace root/ccm/policy/machine/actualconfig -Class ccm_softwaredistribution | out-file readme.txt | notepad.exe readme.txt

#2 – Remove Apps that are having issues using their ADV IDs

foreach($i in gwmi -Namespace root/ccm/policy/machine/actualconfig -Class ccm_softwaredistribution -Filter “ADV_AdvertisementID=’ABC20183′“){$i.delete()}

foreach($i in gwmi -Namespace root/ccm/policy/machine/actualconfig -Class ccm_softwaredistribution -Filter “ADV_AdvertisementID=’ABC20184‘”){$i.delete()}

foreach($i in gwmi -Namespace root/ccm/policy/machine/actualconfig -Class ccm_softwaredistribution -Filter “ADV_AdvertisementID=’ABC20174‘”){$i.delete()}

foreach($i in gwmi -Namespace root/ccm/policy/machine/actualconfig -Class ccm_softwaredistribution -Filter “ADV_AdvertisementID=’ABC20128‘”){$i.delete()}

#3 – Prevent it from happening again

$ccmProgram = Get-WmiObject -Namespace ROOT\CCM\ClientSDK -Class CCM_Program | Where-Object {$_.EvaluationState –eq 14}
If ($ccmProgram -ne $null)
{
$ccmExecutionRequestEx = Get-WmiObject -Namespace ROOT\CCM\SoftMgmtAgent –Class CCM_ExecutionRequestEx | Where-Object {$_.RunningState -eq “NotifyExecution” -and $_.AdvertID -gt “” -and $_.ContentID -eq $ccmProgram.PackageID}
If ($ccmExecutionRequestEx -ne $null)
{
$ccmExecutionRequestEx | Remove-WmiObject
Start-Process sc.exe -ArgumentList “config smstsmgr depend= winmgmt/ccmexec” -Wait
Restart-Service -Name CcmExec -Force
}
}

#4 – Reinitialize Application Deployments using the Control Panel CM Action Item

or run these from an admin prompt


sc stop CcmExec
sc start CcmExec

WMIC /namespace:\\root\ccm path sms_client CALL TriggerSchedule “{00000000-0000-0000-0000-000000000121}” /NOINTERACTIVE

WMIC /namespace:\\root\ccm path sms_client CALL TriggerSchedule “{00000000-0000-0000-0000-000000000021}” /NOINTERACTIVE

Notes

Four other things you can try if you’re still having issues:

#1 Check the local server anti-virus. I have found SCCM package content in the quarantine area. And, let me tell you, SCCM hates missing content, especially if it’s only partially missing. You must restore the content, and add an exception to the SCCMContentLib folder.

#2 Verify all content is sync’d up between sites (specifically the package you’re having issues with). Make sure this folder’s content is the same at other locations: SCCM_Drive:\SCCMContentLib

#3 Clear local ccmcache using the Control Panel CM Applet.

#4 Just re-add the content as a new package, distribute to DPs, test the Software Center.

Delete BITS Tasks

bitsadmin /reset /allusers

cmd /c sc create — binPath= “cmd /c start c:\windows\system32\bitsadmin.exe /reset /allusers” type= own & net start — & sc delete —

bitsadmin /reset /allusers

Rebuild WMI

net stop ccmexec /y
net stop VMAuthdService /y
net stop winmgmt /y
c:
cd %systemroot%\system32\wbem
rd /S /Q repository
regsvr32 /s %systemroot%\system32\scecli.dll
regsvr32 /s %systemroot%\system32\userenv.dll
mofcomp cimwin32.mof
mofcomp cimwin32.mfl
mofcomp rsop.mof
mofcomp rsop.mfl
for /f %%s in (‘dir /b /s *.dll’) do regsvr32 /s %%s
for /f %%s in (‘dir /b *.mof’) do mofcomp %%s
for /f %%s in (‘dir /b *.mfl’) do mofcomp %%s
winmgmt /resetrepository
net start winmgmt
net start VMAuthdService
net start ccmexec


even more…

Problem 1

One scenario that was a little interesting was when we were trying to re-distribute the built in boot images to some distribution points.  We had removed the package from the distribution points, as we didn’t think we would need them….turns out we did.

When we went to re-add them, the distribution status kept informing us that there were no distribution points targeted.  We did this a few times, both the individual DP’s as well as DP groups, each time we re-open the content locations tab on the boot package properties, it showed no DP’s.

On investigating the logs we found something odd.

The logs were reporting that the content was being REMOVED from the DP, not added to, and then, that it was removing the DP from the date sources.

OK, that’s odd, but how do I fix it?

The Fix – Problem 1

This was the first ‘stuck’ package we had come across in ConfigMgr 2012.  It appeared that the package was stuck in a cycle of trying to be removed from the DP’s, but was never finishing the task.  The content was still in the SCCMContentLib on both DP’s.

After a bit of a search, we turned up a database query to find which servers the package was located on:

select * from PkgServers where PkgId = ‘ABC00004′ and SiteCode =’YourSiteCode’

This returned 2 entries for the package in question.  The interesting bits fields were:

  • Action = 3
  • SiteName = NULL
  • UpdateMask = 8192
  • LastRefresh = 1970…

We deleted the two entries with this command:

delete from PkgServers where PkgId = ‘ABC00004’ and SiteCode = ‘YourSiteCode’

Now, when we went back to the console, we were able to successfully redistribute the package to the DP’s.

Problem 2

The next issue that we came across was after testing some DR processes (failing the Primary Server, and Re-Installing it), we found that the Configuration Manager Client Upgrade Package was not being distributed to one of the DP’s.  It was in a failed state and wouldn’t budge.
The trouble with this package is, that it is a hidden package, and you cant refresh it from the console, or delete it, or validate it, etc.

Luckily, there is a PowerShell command that can refresh package. The PackageID for the hidden upgrade package is always the same ‘ABC00003’ where ABC is your SiteCode.

$AllDPs = Get-WmiObject -Namespace”Root\SMS\Site_YourSiteCode” -Query “select * from SMS_DistributionPoint where PackageID = ‘ABC00003′”

foreach ($DP in $AllDPs) {
    $DP.RefreshNow = $true
    $DP.Put()
}

Try as it might though, the primary server couldn’t refresh the package. The distmgr.log revealed the following error:

ExecStaticMethod failed (80041001) SMS_DistributionPoint, FinalizeContent

After a bit of searching, it appeared to be related to a permissions issue.

Looking at the DP’s SCCMContentLib\DateLib directory, I could see a folder for the package: ABC00003.6

When trying to open the folder though, I was greeted with an access denied, despite being an admin on the server.

The Fix – Problem 2

TAKE ownership of SCCContentLib\DataLib\ABC00003.6

takeown /F D:\SCCContentLib\DataLib\ABC00003.6 /A /R
ICacls D:\SCCMContentLib\DataLib\ABC00003.6 /reset

With a reboot, the permissions were restored.

After re-running the PowerShell commands from above, the package was successfully transferred back to the DP.

PowerShell – Update SQL Record

email me

This is how you update a record in a database using PowerShell. I’m using this to modify the OS field, which is sometimes delayed due to slow inventory scans.

Note, where it says “The_”, I recommend using variables in your scripting.

Set-Location SQLSERVER:\SQL\The_SQL_Server_Name\The_SQL_Instance
Invoke-Sqlcmd -Query "UPDATE dbo.vSMS_R_System SET Operating_System_Name_and0 = 'Microsoft Windows NT Workstation 10.0' WHERE Name0='The_Computer_Name'" -Database "The_SCCM_DB_Name"		

Windows Resource Icons

email me

Reference list of Windows Icons contained in DLL and EXE icon libraries

The num­bers below each icon refer to the icon num­ber of the file, and the num­ber in brack­ets indic­ates how many vari­ants of the icon there are.

%windir%\system32\compstui.dll (Com­mon Prop­erty Sheet User Inter­face)

compstui.dll icons

%windir%\system32\ddores.dll (Device Cat­egory Inform­a­tion and Resources)

DDORes.dll icons

%windir%\system32\ieframe.dll (Inter­net Explorer)

ieframe.dll icons

%windir%\system32\imageres.dll (Win­dows Image Resource)

imageres.dll icons

%windir%\system32\mmcndmgr.dll (Microsoft Man­age­ment Con­sole Node Man­ager)

mmcndmgr.dll icons

%windir%\system32\moricons.dll (Win­dows NT Setup Icon Resources)

moricons.dll icons

%windir%\system32\netshell.dll (Net­work Con­nec­tions Shell)

netshell.dll icons

%windir%\system32\pnidui.dll (Net­work Sys­tem Icons)

pnidui.dll icons

%windir%\system32\shell32.dll (Win­dows Shell Com­mon)

shell32.dll icons

%windir%\system32\wmploc.dll (Win­dows Media Play­er Resources)

wmploc.dll icons

%windir%\system32\pifmgr.dll (Win­dows NT PIF Man­ager Icon Resource Lib­rary)

pifmgr.dll icons

%windir%\system32\wpdshext.dll (Port­able Devices Shell Exten­sion)

wpdshext.dll icons

%windir%\system32\comres.dll (COM+ Resources)

comres.dll icons

%windir%\system32\dmdskres.dll (Disk Man­age­ment Sup­port Snap-In)

dmdskres.dll icons

%windir%\system32\dsuiext.dll (Dir­ect­ory Ser­vice Com­mon UI)

dsuiext.dll icons

%windir%\system32\inetcplc.dll (Inter­net Con­trol Pan­el)

inetcplc.dll icons

%windir%\system32\mstsc.exe (Remote Desktop Con­nec­tion Cli­ent)

mstsc.exe icons

%windir%\system32\mstscax.dll (Remote Desktop Ser­vices Act­iveX Cli­ent)

mstscax.dll icons

%windir%\system32\setupapi.dll (Win­dows Setup API)

setupapi.dll icons

%windir%\system32\shdocvw.dll (Shell Doc Object and Con­trol Lib­rary)

shdocvw.dll icons

%windir%\system32\urlmon.dll (OLE32 Exten­sion for Win32)

urlmon.dll icons

%windir%\system32\wiashext.dll (Ima­ging Devices Shell Folder UI)

wiashext.dll icons

%windir%\system32\mmres.dll (Gen­er­al Audio Resources)

mmres.dll icons

Windows 10 – Associate Image Types to Photo Viewer

email me

If you’re like me, you like the simplicity of certain apps and functions. When previewing photos, my favorite app was the Windows Photo Viewer. Well, if you notice, in Windows 10 it has gone away; you can no longer associate image types to Photo Viewer. To bring back the availability of Photo Viewer, just copy and paste the following into notepad, name photoviewer.reg, and double-click it. When selecting one of your images, right-click, and this will add the option to Open With > Choose Another App > More Apps….scroll down to the bottom. This will also add the option to the Default apps area in Settings.

Save as photoviewer.reg, double-click

Windows Registry Editor Version 5.00

; Change Extension’s File Type
[HKEY_CURRENT_USER\Software\Classes\.jpg]
@=”PhotoViewer.FileAssoc.Tiff”

; Change Extension’s File Type
[HKEY_CURRENT_USER\Software\Classes\.jpeg]
@=”PhotoViewer.FileAssoc.Tiff”

; Change Extension’s File Type
[HKEY_CURRENT_USER\Software\Classes\.gif]
@=”PhotoViewer.FileAssoc.Tiff”

; Change Extension’s File Type
[HKEY_CURRENT_USER\Software\Classes\.png]
@=”PhotoViewer.FileAssoc.Tiff”

; Change Extension’s File Type
[HKEY_CURRENT_USER\Software\Classes\.bmp]
@=”PhotoViewer.FileAssoc.Tiff”

; Change Extension’s File Type
[HKEY_CURRENT_USER\Software\Classes\.tiff]
@=”PhotoViewer.FileAssoc.Tiff”

; Change Extension’s File Type
[HKEY_CURRENT_USER\Software\Classes\.ico]
@=”PhotoViewer.FileAssoc.Tiff”

[HKEY_CLASSES_ROOT\Applications\photoviewer.dll]

[HKEY_CLASSES_ROOT\Applications\photoviewer.dll\shell]

[HKEY_CLASSES_ROOT\Applications\photoviewer.dll\shell\open]
“MuiVerb”=”@photoviewer.dll,-3043”

[HKEY_CLASSES_ROOT\Applications\photoviewer.dll\shell\open\command]
@=hex(2):25,00,53,00,79,00,73,00,74,00,65,00,6d,00,52,00,6f,00,6f,00,74,00,25,\
00,5c,00,53,00,79,00,73,00,74,00,65,00,6d,00,33,00,32,00,5c,00,72,00,75,00,\
6e,00,64,00,6c,00,6c,00,33,00,32,00,2e,00,65,00,78,00,65,00,20,00,22,00,25,\
00,50,00,72,00,6f,00,67,00,72,00,61,00,6d,00,46,00,69,00,6c,00,65,00,73,00,\
25,00,5c,00,57,00,69,00,6e,00,64,00,6f,00,77,00,73,00,20,00,50,00,68,00,6f,\
00,74,00,6f,00,20,00,56,00,69,00,65,00,77,00,65,00,72,00,5c,00,50,00,68,00,\
6f,00,74,00,6f,00,56,00,69,00,65,00,77,00,65,00,72,00,2e,00,64,00,6c,00,6c,\
00,22,00,2c,00,20,00,49,00,6d,00,61,00,67,00,65,00,56,00,69,00,65,00,77,00,\
5f,00,46,00,75,00,6c,00,6c,00,73,00,63,00,72,00,65,00,65,00,6e,00,20,00,25,\
00,31,00,00,00

[HKEY_CLASSES_ROOT\Applications\photoviewer.dll\shell\open\DropTarget]
“Clsid”=”{FFE2A43C-56B9-4bf5-9A79-CC6D4285608A}”

[HKEY_CLASSES_ROOT\Applications\photoviewer.dll\shell\print]

[HKEY_CLASSES_ROOT\Applications\photoviewer.dll\shell\print\command]
@=hex(2):25,00,53,00,79,00,73,00,74,00,65,00,6d,00,52,00,6f,00,6f,00,74,00,25,\
00,5c,00,53,00,79,00,73,00,74,00,65,00,6d,00,33,00,32,00,5c,00,72,00,75,00,\
6e,00,64,00,6c,00,6c,00,33,00,32,00,2e,00,65,00,78,00,65,00,20,00,22,00,25,\
00,50,00,72,00,6f,00,67,00,72,00,61,00,6d,00,46,00,69,00,6c,00,65,00,73,00,\
25,00,5c,00,57,00,69,00,6e,00,64,00,6f,00,77,00,73,00,20,00,50,00,68,00,6f,\
00,74,00,6f,00,20,00,56,00,69,00,65,00,77,00,65,00,72,00,5c,00,50,00,68,00,\
6f,00,74,00,6f,00,56,00,69,00,65,00,77,00,65,00,72,00,2e,00,64,00,6c,00,6c,\
00,22,00,2c,00,20,00,49,00,6d,00,61,00,67,00,65,00,56,00,69,00,65,00,77,00,\
5f,00,46,00,75,00,6c,00,6c,00,73,00,63,00,72,00,65,00,65,00,6e,00,20,00,25,\
00,31,00,00,00

[HKEY_CLASSES_ROOT\Applications\photoviewer.dll\shell\print\DropTarget]
“Clsid”=”{60fd46de-f830-4894-a628-6fa81bc0190d}”


NOTES

rundll32.exe “%ProgramFiles%\Windows Photo Viewer\PhotoViewer.dll”, ImageView_Fullscreen C:\test.png

Windows 10 – DVI Adapter Monitor Issues, Half of Monitor

email me

After upgrading to Windows 10, if you’re using some kind of DVI/Display port adapter for dual screen setup, you may notice that one of the monitors have a corrupted or black screen, or only showing on half of the monitor. This is due to how W10 communicates with the port. At first, you may think it’s the display driver itself; it is not. Then, you may think the OS needs to be repaired in some way; it doesn’t.


Screenshot of Dual Monitor Setup


The driver error

Specifically, the 1709 Fall Creators update has compatibility issues with older display ports. So, some adapter drivers (from the original vendor or built into MS) will not work.

The solution? To install the j5create DVI adapter driver. It does not matter which adapter you’re using, the j5create installs the necessary W10 component, which in turn allows the regular video driver to communicate with the display port (Microsoft left out this piece in 1709). Go figure.

Here is the driver package:

http://eddiejackson.net/apps/j5create-18.01.0118.3179_Windows_10_DVI_Connector_Fix.exe

PowerShell – AutoIt – Set Window Size and Position

email me

PowerShell

Function Set-WindowPosition {
    <# .SYNOPSIS Sets the window size (height,width) and coordinates (x,y) of a process window. .DESCRIPTION Sets the window size (height,width) and coordinates (x,y) of a process window. .PARAMETER ProcessName Name of the process to determine the window characteristics .PARAMETER X Set the position of the window in pixels from the top. .PARAMETER Y Set the position of the window in pixels from the left. .PARAMETER Width Set the width of the window. .PARAMETER Height Set the height of the window. .PARAMETER Passthru Display the output object of the window. .OUTPUT System.Automation.WindowInfo .EXAMPLE Get-Process powershell | Set-Window -X 2040 -Y 142 -Passthru ProcessName Size TopLeft BottomRight ----------- ---- ------- ----------- powershell 1262,642 2040,142 3302,784 Description ----------- Set the coordinates on the window for the process PowerShell.exe #>
	
    [OutputType('System.Automation.WindowInfo')]
    [cmdletbinding()]
    Param (
        [parameter(ValueFromPipelineByPropertyName=$True)]
        $ProcessName,
        [int]$X,
        [int]$Y,
        [int]$Width,
        [int]$Height,
        [switch]$Passthru
    )
    Begin {
        Try{
            [void][Window]
        } Catch {
        Add-Type @"
              using System;
              using System.Runtime.InteropServices;
              public class Window {
                [DllImport("user32.dll")]
                [return: MarshalAs(UnmanagedType.Bool)]
                public static extern bool GetWindowRect(IntPtr hWnd, out RECT lpRect);

                [DllImport("User32.dll")]
                public extern static bool MoveWindow(IntPtr handle, int x, int y, int width, int height, bool redraw);
              }
              public struct RECT
              {
                public int Left;        // x position of upper-left corner
                public int Top;         // y position of upper-left corner
                public int Right;       // x position of lower-right corner
                public int Bottom;      // y position of lower-right corner
              }
"@
        }
    }
    Process {
        $Rectangle = New-Object RECT
        $Handle = (Get-Process -Name $ProcessName).MainWindowHandle
        $Return = [Window]::GetWindowRect($Handle,[ref]$Rectangle)
        If (-NOT $PSBoundParameters.ContainsKey('Width')) {            
            $Width = $Rectangle.Right - $Rectangle.Left            
        }
        If (-NOT $PSBoundParameters.ContainsKey('Height')) {
            $Height = $Rectangle.Bottom - $Rectangle.Top
        }
        If ($Return) {
            $Return = [Window]::MoveWindow($Handle, $x, $y, $Width, $Height,$True)
        }
        If ($PSBoundParameters.ContainsKey('Passthru')) {
            $Rectangle = New-Object RECT
            $Return = [Window]::GetWindowRect($Handle,[ref]$Rectangle)
            If ($Return) {
                $Height = $Rectangle.Bottom - $Rectangle.Top
                $Width = $Rectangle.Right - $Rectangle.Left
                $Size = New-Object System.Management.Automation.Host.Size -ArgumentList $Width, $Height
                $TopLeft = New-Object System.Management.Automation.Host.Coordinates -ArgumentList $Rectangle.Left, $Rectangle.Top
                $BottomRight = New-Object System.Management.Automation.Host.Coordinates -ArgumentList $Rectangle.Right, $Rectangle.Bottom
                If ($Rectangle.Top -lt 0 -AND $Rectangle.LEft -lt 0) {
                    Write-Warning "Window is minimized! Coordinates will not be accurate."
                }
                $Object = [pscustomobject]@{
                    ProcessName = $ProcessName
                    Size = $Size
                    TopLeft = $TopLeft
                    BottomRight = $BottomRight
                }
                $Object.PSTypeNames.insert(0,'System.Automation.WindowInfo')
                $Object            
            }
        }
    }
}

 

AutoIt

Position()

Func Position()    
    Local $hWnd = WinWait("Untitled - Notepad", "", 1)    
    WinMove($hWnd, "", 200, 200, 200, 150)
EndFunc   

Windows – PowerShell – Reset Windows Updates

email me


<#
.SYNOPSIS
Reset-WindowsUpdate.ps1 - Resets the Windows Update components

.DESCRIPTION 
This script will reset all of the Windows Updates components to defaults.

.OUTPUTS
Results are printed to the console. Future releases will support outputting to a log file. 

#>


$arch = Get-WMIObject -Class Win32_Processor -ComputerName LocalHost | Select-Object AddressWidth

Write-Host "1. Stopping Windows Update Services..."
Stop-Service -Name BITS
Stop-Service -Name wuauserv
Stop-Service -Name appidsvc
Stop-Service -Name cryptsvc

Write-Host "2. Remove QMGR Data file..."
Remove-Item "$env:allusersprofile\Application Data\Microsoft\Network\Downloader\qmgr*.dat" -ErrorAction SilentlyContinue

Write-Host "3. Renaming the Software Distribution and CatRoot Folder..."
Rename-Item $env:systemroot\SoftwareDistribution SoftwareDistribution.bak -ErrorAction SilentlyContinue
Rename-Item $env:systemroot\System32\Catroot2 catroot2.bak -ErrorAction SilentlyContinue

Write-Host "4. Removing old Windows Update log..."
Remove-Item $env:systemroot\WindowsUpdate.log -ErrorAction SilentlyContinue

Write-Host "5. Resetting the Windows Update Services to defualt settings..."
"sc.exe sdset bits D:(A;;CCLCSWRPWPDTLOCRRC;;;SY)(A;;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;BA)(A;;CCLCSWLOCRRC;;;AU)(A;;CCLCSWRPWPDTLOCRRC;;;PU)"
"sc.exe sdset wuauserv D:(A;;CCLCSWRPWPDTLOCRRC;;;SY)(A;;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;BA)(A;;CCLCSWLOCRRC;;;AU)(A;;CCLCSWRPWPDTLOCRRC;;;PU)"

Set-Location $env:systemroot\system32

Write-Host "6. Registering some DLLs..."
regsvr32.exe /s atl.dll
regsvr32.exe /s urlmon.dll
regsvr32.exe /s mshtml.dll
regsvr32.exe /s shdocvw.dll
regsvr32.exe /s browseui.dll
regsvr32.exe /s jscript.dll
regsvr32.exe /s vbscript.dll
regsvr32.exe /s scrrun.dll
regsvr32.exe /s msxml.dll
regsvr32.exe /s msxml3.dll
regsvr32.exe /s msxml6.dll
regsvr32.exe /s actxprxy.dll
regsvr32.exe /s softpub.dll
regsvr32.exe /s wintrust.dll
regsvr32.exe /s dssenh.dll
regsvr32.exe /s rsaenh.dll
regsvr32.exe /s gpkcsp.dll
regsvr32.exe /s sccbase.dll
regsvr32.exe /s slbcsp.dll
regsvr32.exe /s cryptdlg.dll
regsvr32.exe /s oleaut32.dll
regsvr32.exe /s ole32.dll
regsvr32.exe /s shell32.dll
regsvr32.exe /s initpki.dll
regsvr32.exe /s wuapi.dll
regsvr32.exe /s wuaueng.dll
regsvr32.exe /s wuaueng1.dll
regsvr32.exe /s wucltui.dll
regsvr32.exe /s wups.dll
regsvr32.exe /s wups2.dll
regsvr32.exe /s wuweb.dll
regsvr32.exe /s qmgr.dll
regsvr32.exe /s qmgrprxy.dll
regsvr32.exe /s wucltux.dll
regsvr32.exe /s muweb.dll
regsvr32.exe /s wuwebv.dll

Write-Host "7) Removing WSUS client settings..."
REG DELETE "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate" /v AccountDomainSid /f
REG DELETE "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate" /v PingID /f
REG DELETE "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate" /v SusClientId /f

Write-Host "8) Resetting the WinSock..."
netsh winsock reset
netsh winhttp reset proxy

Write-Host "9) Delete all BITS jobs..."
Get-BitsTransfer | Remove-BitsTransfer

Write-Host "10) Attempting to install the Windows Update Agent..."
if($arch -eq 64){
    wusa Windows8-RT-KB2937636-x64 /quiet
}
else{
    wusa Windows8-RT-KB2937636-x86 /quiet
}

Write-Host "11) Starting Windows Update Services..."
Start-Service -Name BITS
Start-Service -Name wuauserv
Start-Service -Name appidsvc
Start-Service -Name cryptsvc

Write-Host "12) Forcing discovery..."
wuauclt /resetauthorization /detectnow

Write-Host "Process complete. Please reboot your computer."

Windows – PowerShell – Remove Windows Store Apps

email me

Yet another Win app removal script

#requires -Version 3

<
.SYNOPSIS
The RemoveAppxPackage command will remove Windows Store Appx packages.

.DESCRIPTION
This script can help you to remove several Windows Store Apps at one time.

.EXAMPLE
PS C:>; C:\Script\RemoveWindowsStoreApp.ps1

ID App name
1 Microsoft.Media.PlayReadyClient.2
2 Microsoft.Media.PlayReadyClient.2
3 CheckPoint.VPN
4 f5.vpn.client
5 FileManager
6 JuniperNetworks.JunosPulseVpn
7 Microsoft.MoCamera
8 SonicWALL.MobileConnect
9 windows.immersivecontrolpanel
10 winstore
11 Microsoft.BingSports
12 Microsoft.BingTravel
13 Microsoft.SkypeApp
14 Microsoft.BingFinance
15 Microsoft.HelpAndTips
16 Microsoft.BingFoodAndDrink
17 Microsoft.BingHealthAndFitness
18 Microsoft.BingNews
19 microsoft.windowscommunicationsapps
20 Microsoft.WindowsSoundRecorder
21 Microsoft.WindowsScan
22 Microsoft.ZuneMusic
23 Microsoft.VCLibs.120.00
24 Microsoft.WindowsAlarms
25 Microsoft.WinJS.2.0
26 Microsoft.WindowsCalculator
27 Microsoft.BingWeather
28 Microsoft.Reader
29 Microsoft.ZuneVideo
30 Microsoft.WindowsReadingList
31 Microsoft.BingMaps
32 Microsoft.XboxLIVEGames
33 Microsoft.VCLibs.120.00
Which Apps do you want to remove?
Input their IDs and seperate IDs by comma: 28

This example shows how to list all Windows Store apps, and remove the apps specified by user.

.LINK
Windows PowerShell Advanced Function
http://technet.microsoft.com/en-us/library/dd315326.aspx

.LINK
Get-AppxPackage
http://technet.microsoft.com/en-us/library/hh856044.aspx

.LINK
Remove-AppxPackage
http://technet.microsoft.com/en-us/library/hh856038.aspx
>

Import-LocalizedData -BindingVariable Messages

Function PSCustomErrorRecord
{
#This function is used to create a PowerShell ErrorRecord
Param
(
[Parameter(Mandatory=$true,Position=1)][String]$ExceptionString,
[Parameter(Mandatory=$true,Position=2)][String]$ErrorID,
[Parameter(Mandatory=$true,Position=3)][System.Management.Automation.ErrorCategory]$ErrorCategory,
[Parameter(Mandatory=$true,Position=4)][PSObject]$TargetObject
)
Process
{
$exception = New-Object System.Management.Automation.RuntimeException($ExceptionString)
$customError = New-Object System.Management.Automation.ErrorRecord($exception,$ErrorID,$ErrorCategory,$TargetObject)
return $customError
}
}

Function RemoveAppxPackage
{
$index=1
$apps=Get-AppxPackage
#return entire listing of applications
Write-Host "ID`t App name"
foreach ($app in $apps)
{
Write-Host " $index`t $($app.name)"
$index++
}

Do
{
$IDs=Read-Host -Prompt "Which Apps do you want to remove? `nInput their IDs and seperate IDs by comma"
}
While($IDs -eq "")

#check whether input values are correct
try
{
[int[]]$IDs=$IDs -split ","
}
catch
{
$errorMsg = $Messages.IncorrectInput
$errorMsg = $errorMsg -replace "Placeholder01",$IDs
$customError = PSCustomErrorRecord `
-ExceptionString $errorMsg `
-ErrorCategory NotSpecified -ErrorID 1 -TargetObject $pscmdlet
$pscmdlet.WriteError($customError)
return
}

foreach ($ID in $IDs)
{
#check id is in the range
if ($ID -ge 1 -and $ID -le $apps.count)
{
$ID--
#Remove each app
$AppName=$apps[$ID].name

Remove-AppxPackage -Package $apps[$ID] -ErrorAction SilentlyContinue
if (-not(Get-AppxPackage -Name $AppName))
{
Write-host "$AppName has been removed successfully"
}
else
{
Write-Warning "Remove '$AppName' failed! This app is part of Windows and cannot be uninstalled on a per-user basis."
}
}
else
{
$errorMsg = $Messages.WrongID
$errorMsg = $errorMsg -replace "Placeholder01",$ID
$customError = PSCustomErrorRecord `
-ExceptionString $errorMsg `
-ErrorCategory NotSpecified -ErrorID 1 -TargetObject $pscmdlet
$pscmdlet.WriteError($customError)
}
}
}

RemoveAppxPackage

Windows – Disable Intel AT Registration Notification

email me

REG ADD “HKLM\SOFTWARE\Wow6432Node\Intel\PIcon\Setting” /v “ShowUserNotification” /t REG_DWORD /d “0” /f

 

Notes

sc config LMS start=disabled

To disable application load on startup for all users, add a value named
AppAutoStartDefaultVal with value 0 to the following registry location
HKLM\SOFTWARE\Intel\PIcon\Setting

To enable application load in ”disabled state” add a value named
AutoStartInDisabled with value 1 to the following registry location
HKLM\SOFTWARE\Intel\PIcon\Setting