PowerShell – Excel Report for a Single Hotfix

email me

# KB to check 
$KB = "KB3176935"

# List of computers to check for KB
$computerList = 'C:\reports\computers.txt'

$setErrorAction = "SilentlyContinue"

# Application setup
$application = New-Object -comobject Excel.Application 
$application.visible = $True
$workbook = $application.Workbooks.Add() 
$addWorksheetItem = $workbook.Worksheets.Item(1)
$initialRow = 2

# Header Properties
$addWorksheetItem.Cells.Item(1,1) = "COMPUTER" 
$addWorksheetItem.Cells.Item(1,2) = "STATUS" 
$headerProperty = $addWorksheetItem.UsedRange
$headerProperty.Interior.ColorIndex = 0
$headerProperty.Font.ColorIndex = 0 
$headerProperty.Font.Bold = $True

# Cycle through computer list
Foreach ($computer in get-content $computerList) 
{     
    $addWorksheetItem.Cells.Item($initialRow,1) = $computer

    $PatchStatus = Get-WMIObject Win32_QuickFixEngineering -computer $computer | where {$_.HotFixID -eq $KB} 
        If($PatchStatus -eq $Null) 
            {   # KB not found
                $addWorksheetItem.Cells.Item($initialRow,2).Interior.ColorIndex = 0 
                $addWorksheetItem.Cells.Item($initialRow,2) = "FALSE" 
            } 
        Else 
            {   # KB found
                $addWorksheetItem.Cells.Item($initialRow,2).Interior.ColorIndex = 0 
                $addWorksheetItem.Cells.Item($initialRow,2) = "TRUE" 
            } 
    
            $initialRow = $initialRow + 1 
            }

    # Resize columns to fix
    $headerProperty.EntireColumn.AutoFit() 

 
 
Screenshot

PowerShell – Excel Report Multiple Hotfixes & Computers

email me

# Add hotfixes to scan for
$hotFixes = @(
    "KB973815", 
    "KB3176935", 
    "KB4019264",
    "KB3138901"
    )

# Add computers to scan for
$computers = (get-content -path c:\reports\computers.txt) 

# Report name
$Report = @()
$reportName = "c:\setup\Report_$(get-date -Uformat "%Y%m%d-%H%M%S").csv" 

# return hotfix
Function Get-HotFixStatus([string]$hotFixes, [string]$computers) 
{ 
  Get-WmiObject -class  win32_QuickFixEngineering -Filter "HotFixID = '$hotfixes'" -computername $computers
} 

# Output to screen - create report with true or false
Function Get-HotFixReport([string[]]$hotFixes, [string[]]$computers) 
{ 
  foreach($computer in $computers) 
  { 
    Write-Host " "
    Write-Host $computer
    foreach ($hotfix in $hotfixes) 
    { 
     Write-Host $hotfix 
     $status =  $(if(Get-HotFixStatus -hotfix $hotfix -computer $computer) {$true} else {$false}) 
     $object = New-Object -TypeName PSObject 
     $object | Add-Member -MemberType NoteProperty -Name Computer -Value $computer 
     $object | Add-Member -MemberType NoteProperty -Name HotFix -Value $hotfix 
     $object | Add-Member -MemberType NoteProperty -Name Installed -Value $status
     Write-host "--" $status
     $object      
    }
   } 
} 

Clear-Host
Write-Host "Compiling report..."
Get-HotFixReport -hotfix $hotfixes -computer $computers | 
Sort-object -property computer | 
Export-Csv $reportName -NoTypeInformation -UseCulture
ii $reportName

Write-Host " "
Write-Host "Done!"

 
 
Screenshot
 

Fixing Windows 10 Broken Apps

email me

If you’re Windows 10 apps aren’t opening, or you’re receiving errors when you click shortcuts on the Start Menu, try this:

Open the Task manager. Click File > Run new task.

In the task dialog box, make sure you check Create this task with administrative privileges.

Type CMD

Type the following 4 commands in the console:

dism /online /cleanup-image /restorehealth

sfc /scannow

powershell

Get-AppXPackage -AllUsers |Where-Object {$_.InstallLocation -like “*SystemApps*”} | Foreach {Add-AppxPackage -DisableDevelopmentMode -Register “$($_.InstallLocation)\AppXManifest.xml”}

 

Notes

If you have problems, log in as administrator, not using a Microsoft online account, and try again.

 

Using a different source WIM

Dism /Online /Cleanup-Image /RestoreHealth /Source:wim:D:\sources\install.wim:1 /limitaccess

 

Repair Windows Store

cmd > wsreset.exe

PowerShell -ExecutionPolicy Unrestricted -Command “& {$manifest = (Get-AppxPackage *WindowsStore*).InstallLocation + ‘\AppxManifest.xml’ ; Add-AppxPackage -DisableDevelopmentMode -Register $manifest}”

 

tags: repair apps, restore apps, fix broken apps

Adobe Flash: Microsoft Security Bulletin MS17-023 – Critical

email me

https://technet.microsoft.com/en-us/library/security/MS17-023

Executive Summary

This security update resolves vulnerabilities in Adobe Flash Player when installed on all supported editions of Windows 8.1, Windows Server 2012, Windows Server 2012 R2, Windows RT 8.1, Windows 10, and Windows Server 2016.

This security update is rated Critical. The update addresses the vulnerabilities in Adobe Flash Player by updating the affected Adobe Flash libraries contained within Internet Explorer 10, Internet Explorer 11, and Microsoft Edge.

For more information about this update, see Microsoft Knowledge Base Article 4014329.

Vulnerability Information

This security update addresses the following vulnerabilities, which are described in Adobe Security Bulletin APSB17-07:

CVE-2017-2997, CVE-2017-2998, CVE-2017-2999, CVE-2017-3000, CVE-2017-3001, CVE-2017-3002, CVE-2017-3003.

Juniper Pulse Client Removal

email me

reg delete “HKLM\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Ciphers” /f
reg delete “HKLM\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Hashes” /f
reg delete “HKLM\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols” /f

  1. Uninstall Juniper or Junos software from Control Panel > Programs and Features; remove all instances of the app.
  2. Delete Juniper and / or Pulse folders from
    C:\Program Files x86\
    C:\Program Files x86\CommonFiles\
    C:\Users\Public
    C:\Users\%username%\AppData\Roaming\
    C:\Users\%username%\AppData\Local\
    C:\ProgramData\
  3. Delete JuniperSetupControl from Start >Control Panel > Internet Options > General > Settings > View Objects
  4. Remove the Juniper Networks Virtual Adapter from Device Manager, click View on top > Select Show Hidden Devices > Go to the Network Adapter and remove Juniper Networks Virtual Adapter
  5. Delete the Juniper / Pulse keys  from the registry:
    HKEY_CURRENT_USER\Software\Juniper Networks
    HKEY_CURRENT_USER\Software\Pulse
    HKEY_LOCAL_MACHINE\Software\Juniper Networks
    HKEY_LOCAL_MACHINE\Software\Pulse
    HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\dsNcApt
    HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\dsNcService
  6. HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion the value ‘DevicePath’ should point to ‘%SystemRoot%\inf’.
  7. Open a command line “as Administrator”, run “pnputil -e > pnplist.txt”, find everything in there that has the name JUNIPER or PULSE in it, then run “pnputil -d oemXX.inf” for each entry, where “XX” is the actual number of the entry.
  8. Restart the machine.
  9. Download and install Juniper Setup Client (I get these MSIs directly from the vendor).
  10. Manually install NCINST64.EXE and check to ensure that it is running on the PC’s SERVICES.  If it is not running, it likely will not start, and if you try to VPN in you will likely see error 23787. 14. Manually install the Pulse Installer Service.
  11. Launch Pulse, set up profile, and try logging in.

PowerShell – Move/Disable Inactive Computers in AD

email me

This is a PowerShell script I wrote to move/disable inactive computer accounts.

Download and install Quest ActiveRoles Management Shell:
http://eddiejackson.net/apps/Quest_ActiveRolesManagementShellforActiveDirectoryx64_151.zip

# SET INACTIVE DAYS
$SetInactive = 120

# SEARCH HERE
$SourceOU = "ou=SEARCHHERE,dc=DOMAIN,dc=com"

# MOVE HERE
$TargetOU = "ou=MOVEHERE,dc=DOMAIN,dc=com"

# REPORT MODE
# Set to True to only show list of computers
# True or False
$RunReport = "True"

# DISABLE COMPUTER ACCOUNT
# Set to True to also disable the computer account
# True or False
$DisableAccount = "False"



#-----------------------------------------------
Add-PSSnapin Quest.ActiveRoles.ADManagement
Clear-Host

If ($RunReport -eq "True") {

    #REPORT MODE
    Write-Host "Report Mode..."
    Write-Host ""
    Get-QADComputer -InactiveFor $SetInactive -SizeLimit 0 -SearchRoot $SourceOU -IncludedProperties ParentContainerDN | foreach {
    $_.ComputerName
}

} else {

    #KILL MODE
    Write-Host "Kill Mode..."
    Write-Host ""

    $objectDescription = "$(Get-TimeStamp) Account moved due to inactivity - SysAdmin"

    Get-QADComputer -InactiveFor $SetInactive -SizeLimit 0 -SearchRoot $SourceOU -IncludedProperties ParentContainerDN | foreach {

    $computer = $_.ComputerName
    $SourceOU = $_.DN

    Set-QADComputer $computer -Description $objectDescription

    If ($DisableAccount -eq "True") {Disable-QADComputer $computer}
        #Enable-QADComputer $computer

    Move-QADObject $computer -NewParentContainer $TargetOU
    "$(Get-TimeStamp) $computer" | Out-File -FilePath $ENV:UserProfile\Desktop\_ADLog.txt -Append
    Write-Host ""

    }
}

function Get-TimeStamp {
    $SetTimestamp = "[" + (Get-Date).ToShortDateString() + " " + ((Get-Date).ToLongTimeString()) + "]"
    Return $SetTimestamp
}

Windows Build Numbers

email me

Operating System Version / Build / Date
Windows 95 OEM Service Release 1 (95A) 4.00.950 A
Windows 95 OEM Service Release 2 (95B) 4.00.1111 B
Windows 95 OEM Service Release 2.1 4.03.1212-1214 B
Windows 95 OEM Service Release 2.5 C 4.03.1214 C
Windows 98 4.10.1998
Windows 98 Second Edition (SE) 4.10.2222 A
Windows Millennium Beta 4.90.2476
Windows Millennium 4.90.3000
Windows NT 3.1 3.10.528.1 (9/11/1993)
Windows NT 3.5 3.50.807 (9/21/1994)
Windows NT 3.51 3.51.1057 (5/30/1995)
Windows NT 4.00 4.00.1381 (8/24/1996)
Windows NT 5.00 (Beta 2) 5.00.1515
Windows 2000 (Beta 3) 5.00.2031
Windows 2000 (Beta 3 RC2) 5.00.2128
Windows 2000 (Beta 3) 5.00.2183
Windows 2000 5.00.2195 (2/17/2000)
Whistler Server Preview 2250
Whistler Server alpha 2257
Whistler Server interim release 2267
Whistler Server interim release 2410
Windows XP (RC 1) 5.1.2505
Windows XP 5.1.2600 (10/25/2001)
Windows XP, Service Pack 1 5.1.2600.1106 (9/9/2002)
Windows XP, Service Pack 2 5.1.2600.2180 (8/25/2004)
Windows XP, Service Pack 3 5.1.2600.5512 (4/21/2008)
Windows .NET Server interim 5.2.3541
Windows .NET Server Beta 3 5.2.3590
Windows .NET Server Release Candidate 1 (RC1) 5.2.3660
Windows .NET Server 2003 RC2 5.2.3718
Windows Server 2003 (Beta?) 5.2.3763
Windows Server 2003 5.2.3790 (4/24/2003)
Windows Server 2003, Service Pack 1 5.2.3790.1180
Windows Server 2003 5.2.3790.1218
Windows Home Server 5.2.3790 (6/16/2007)
Windows Longhorn 6.0.5048
Windows Vista, Beta 1 6.0.5112 (7/20/2005)
Windows Vista, Community Technology Preview (CTP) 6.0.5219 (8/30/2005)
Windows Vista, TAP Preview 6.0.5259 (11/17/2005)
Windows Vista, CTP (December) 6.0.5270 (12/14/2005)
Windows Vista, CTP (February) 6.0.5308 (2/17/2006)
Windows Vista, CTP (Refresh) 6.0.5342 (3/21/2006)
Windows Vista, April EWD 6.0.5365 (4/19/2006)
Windows Vista, Beta 2 Preview 6.0.5381 (5/1/2006)
Windows Vista, Beta 2 6.0.5384 (5/18/2006)
Windows Vista, Pre-RC1 6.0.5456 (6/20/2006)
Windows Vista, Pre-RC1, Build 5472 6.0.5472 (7/13/2006)
Windows Vista, Pre-RC1, Build 5536 6.0.5536 (8/21/2006)
Windows Vista, RC1 6.0.5600.16384 (8/29/2006)
Windows Vista, Pre-RC2 6.0.5700 (8/10/2006)
Windows Vista, Pre-RC2, Build 5728 6.0.5728 (9/17/2006)
Windows Vista, RC2 6.0.5744.16384 (10/3/2006)
Windows Vista, Pre-RTM, Build 5808 6.0.5808 (12.10.2006)
Windows Vista, Pre-RTM, Build 5824 6.0.5824 (10/17/2006)
Windows Vista, Pre-RTM, Build 5840 6.0.5840 (10/18/2006)
Windows Vista, RTM (Release to Manufacturing) 6.0.6000.16386 (11/1/2006)
Windows Vista 6.0.6000 (11/8/2006)
Windows Vista, Service Pack 2 6.0.6002 (2/04/2008)
Windows Server 2008 6.0.6001 (2/27/2008)
Windows 7, RTM (Release to Manufacturing) 6.1.7600.16385 (10/22/2009)
Windows 7 6.1.7600 (10/22/2009)
Windows 7, Service Pack 1 6.1.7601
Windows Server 2008 R2, RTM (Release to Manufacturing) 6.1.7600.16385 (10/22/2009)
Windows Server 2008 R2, SP1 6.1.7601
Windows Home Server 2011 6.1.8400 (4/5/2011)
Windows Server 2012 6.2.9200 (9/04/2012)
Windows 8 6.2.9200 (10/26/2012)
Windows Phone 8 6.2.10211 (10/29/2012)
Windows Server 2012 R2 6.3.9200 (10/18/2013)
Windows 8.1 6.3.9200 (10/17/2013)
Windows 8.1, Update 1 6.3.9600 (4//8/2014)
Windows 10 10.0.10240 (7/29/2015)
Windows 10 (1511) 10.0.10586 (11/10/2015)
Windows 10 (1607) 10.0.14393 (2/8/2016)
Windows 10 (1703) 10.0.15063 (04/11/2017)
Windows 10 (1709) 10.0.16299 (10/17/2017)
Windows 10 (1803) 10.0.17134 (5/8/2018)
Windows 10 (1809) 10.0.17763 (10/2/2018)
Windows 10 (1903) 10.0.18362 (05/21/2019)
Windows 10 (1909) 10.0.18363 (11/12/2019)
Windows 10 (2004) 10.0.19041 (5/27/2020)
Windows 10 (20H2) 10.0.19042 (10/20/2020)
Windows 10 (21H1) 10.0.19043 (05/18/2021)
Windows 10 (21H2) 10.0.19044 (11/16/2021)
Windows 10 (22H2) 10.0.19045 (10/18/2022)

Visual Studio – TextHighlighterExtension2015

email me

This Visual Studio extension offers syntax highlighting for the following text formats:

.bat (also offer limited intellisense)
.cmd
.ini
.Log4j.properties file
.sh Bash file (alpha)
.txt
.log
.json is now supported by Visual Studio 2015!
(see bottom for extension)

.ps1
(also see bottom for PoshTools)

 

The extension comes with default colors set for black and white background.

To change colors, check here:
C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\Extensions\r5vacxma.cek\COLORS_DEFINITION_DARK.json

C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\Extensions\r5vacxma.cek\COLORS_DEFINITION_LIGHT.json

To update keywords, check here:
C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\Extensions\r5vacxma.cek\KEYWORDS.json

To add intellisense to batch files, check here:
C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\Extensions\r5vacxma.cek\Intellisense.json

 

Snapshot of the highlighting in Visual Studio (I love it!)

* I did have to run this as administrator for it to work, but I don’t care…still love it.

 

   

Visual Studio – Command Task Runner

email me

This Visual Studio extension adds support for command line batch files in Visual Studio 2015’s Task Runner Explorer.

Supports .exe, .cmd, .bat, .ps1 and .psm1 files.

 

Add commands

The easiest way to add a batch file to Task Runner Explorer is to right-click it in Solution Explorer and select Add to Task Runner

You can right-click supported batch files in either solution folders or from within a any project.

Doing so will create a commands.json file. If you right-clicked a batch file in a solution folder, then the commands.json file will be placed in the solution folder. If the batch file is in a project you will be prompted to select to either put it in the project or solution folder.

If a commands.json file already exist, the new batch file will be added.

 

Execute scripts

When scripts are specified, the Task Runner Explorer will show those scripts.

Each script can be executed by double-clicking the task.

 

commands.json locations

The Task Runner Explorer supports multiple task runners in the same solution. For instance, you can have commands specified for the solution and additional ones for each project in that solution.

Task Runner Explorer will try to find a commands.json file in any parent folder to either the individual projects or the solution until it hits the root of the drive.

 

Commands

Inside commands.json it is possible to add custom scripts inside the “scripts” element.

{ “commands”: { “Build”: { “FileName”: “cmd.exe”, “WorkingDirectory”: “.”, “Arguments”: “/c build\build.cmd” } }}