The Wiert Corner – irregular stream of stuff

Jeroen W. Pluimers on .NET, C#, Delphi, databases, and personal interests

  • My badges

  • Twitter Updates

  • My Flickr Stream

  • Pages

  • All categories

  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 1,640 other followers

Archive for the ‘Power User’ Category

Reminder to self: MacOS prints to HP printers using IPP on port 631

Posted by jpluimers on 2019/07/12

At a site, something in the network filtering changed, so printing from a Mac failed.

In the end this was about port 631, which is for the IPP protocol a Mac uses.

jeroen

Posted in Apple, Mac, Power User | Leave a Comment »

Government & Govt Owned – Netherlands – Phishing Scorecard

Posted by jpluimers on 2019/07/12

The archive is of late 2017; I wonder what the state is now: [WaybackGovernment & Govt Owned – Netherlands – Phishing Scorecard

This Phishing Scorecard is the current situation of the security of e-mail stream banks compared. If a bank is one of the technical building blocks to implement in their e-mail security the red cross will be a green check mark. Once a bank’s security policy has only green check marks will stand up and protect them 40% of their customers.

–jeroen

Via: [WayBack‘Mailservers Tweede Kamer missen beveiliging tegen e-mailspoofing’ – update – IT Pro – Nieuws – Tweakers

De mailservers van de Tweede Kamer missen beveiligingsmaatregelen die e-mailspoofing tegen moeten gaan, waardoor het mogelijk is om uit naam van politici e-mails te versturen. Dat blijkt uit een onderzoek van Follow the Money.

Posted in Power User, Security | Leave a Comment »

PowerShell: get WindowsUpdate information

Posted by jpluimers on 2019/07/11

A while back, I needed to check Windows Update information on a few hosts, so I wanted to script it. Below are a few links that helped me solve this started.

Note: For Windows Update, you need the TiWorker.exe process, which can consume a lot of CPU. See DISM fix for Windows 8.1 high CPU usage of TiWorker.exe which is basically the same for all Windows versions since 8.0.

The infrastructure management on that site was ehm, a bit lacking, so PowerShell modules were out, heck even PowerShell itself was initially problematic (it needed running of unsigned sources.

A few notes on the above links.

Using Microsoft.Update.AutoUpdate

This gets the last date that anything was done (query, actual update, download) on Windows Updates, but does not guarantee the installation date; on some systems it does not even return a result:

$windowsUpdateObject = New-Object -ComObject Microsoft.Update.AutoUpdate
$windowsUpdateObject.Results

This one works better though:

$windowsUpdateObject = New-Object -ComObject Microsoft.Update.AutoUpdate
$windowsUpdateObject.Results.LastInstallationSuccessDate

Based on that, you can get the number of days like this:

(New-TimeSpan -Start $windowsUpdateObject.Results.LastInstallationSuccessDate.Date -End (Get-Date)).Days

Using Get-HotFix

Though some people report that InstalledOn can be empty, I’ve hardly that happen with Get-HotFix. The easiest way to get around that is filtering with | Where-Object InstalledOn -ne $null

The cool thing with Get-HotFix is that you can filter on the kind of security update, so this gets the moment the last security update got installed:

(Get-HotFix -Description "Security Update" | Where-Object InstalledOn -ne $null | Sort-Object InstalledOn -Descending | Select-Object -First 1).InstalledOn

And this the number of days since the last security update got installed:

(New-TimeSpan -Start (Get-HotFix -Description "Security Update" | Where-Object InstalledOn -ne $null | Sort-Object InstalledOn -Descending | Select-Object -First 1).InstalledOn -End (Get-Date)).Days

Step by step:

Get-HotFix -Description "Security Update"

Gets all the security updates.

| Where-Object InstalledOn -ne $null

Filter out entries having an empty InstalledOn.

Sort-Object InstalledOn -Descending

Get the most recent on the top.

| Select-Object -First 1

Select only the top entry.

(Get-HotFix -Description "Security Update"...).InstalledOn

Get only the InstalledOn property.

Get-Date

Get the current timestamp consisting of date and time.

New-TimeSpan -Start (...).InstalledOn -End (Get-Date)

Get a TimeSpan over a start and end timestamp.

(New-TimeSpan ...).Days

Get the Days property of a TimeSpan.

You can do the same for regular updates by changing the -Description parameter:

(Get-HotFix -Description "Update" | Where-Object InstalledOn -ne $null | Sort-Object InstalledOn -Descending | Select-Object -First 1).InstalledOn
(New-TimeSpan -Start (Get-HotFix -Description "Update" | Where-Object InstalledOn -ne $null | Sort-Object InstalledOn -Descending | Select-Object -First 1).InstalledOn -End (Get-Date)).Days

The Description values I found are these:

PS C:\Users\Developer> Get-HotFix | Sort-Object -Unique Description | Select-Object Description

Description
-----------
Hotfix
Security Update
Update

Ironically, since the command is called Get-HotFix, the Hotfix entries on my various Windows systems have been a  long long time ago:

(New-TimeSpan -Start (Get-HotFix -Description "Hotfix" | Where-Object InstalledOn -ne $null | Sort-Object InstalledOn -Descending | Select-Object -First 1).InstalledOn -End (Get-Date)).Days

When writing this in 2017, on Windows 8.1, this was more than 600 days, Windows 7 more than 400 days and Windows 10 did not have any Hotfix entries.

Old PowerShell versions

On PowerShell 2 and older, you get an error containing “Where-Object : Cannot bind parameter ‘FilterScript'”:

Where-Object : Cannot bind parameter 'FilterScript'. Cannot convert the "InstalledOn" value of type "System.String" to type "System.Management.Automation.ScriptBlock".
At line:1 char:48
+ (New-TimeSpan -Start (Get-HotFix | Where-Object <<<< InstalledOn -ne $null | Sort-Object InstalledOn -Descending | Select-Object -First 1).InstalledOn -End (Get-Date)).Days
+ CategoryInfo : InvalidArgument: (:) [Where-Object], ParameterBindingException
+ FullyQualifiedErrorId : CannotConvertArgumentNoMessage,Microsoft.PowerShell.Commands.WhereObjectCommand

You solve it like this:

(New-TimeSpan -Start (Get-HotFix | Where-Object { $_.InstalledOn -ne $null } | Sort-Object InstalledOn -Descending | Select-Object -First 1).InstalledOn -End (Get-Date)).Days

By now code has become almost unreadable, so you can split it using backtick ` characters:

( `
New-TimeSpan -Start `
  ( `
    Get-HotFix | Where-Object { $_.InstalledOn -ne $null } `
    | Sort-Object InstalledOn -Descending `
    | Select-Object -First 1 `
  ).InstalledOn `
  -End (Get-Date)`
).Days

One more thing

On non-English Windows systems, the InstalledOn might actually be in the future, as you can view this happening by this simple command which I ran on 2017-11-02 :

Get-HotFix | Out-GridView

You solve it by adding a filter:

Get-HotFix | Where-Object InstalledOn -lt (Get-Date) | Out-GridView

If you run them from a script (like a batch file Get-HotFix ^| Out-GridView or ps1 file Get-HotFix | Out-GridView), then the grid-view will pop-up and immediately close because the PowerShell process ends. In that case, you need to change your scripts to add the -Wait parameter:

PowerShell Get-HotFix ^| Out-GridView -Wait

Powershell.exe -Command "Get-HotFix | Out-GridView -Wait"

Get-HotFix | Out-GridView -Wait

See:

In C#

If I ever want to do the same from C#, I need to figure out where to get the WUApiLib from; more on that library is at [WayBack] Use C# to interact with Windows Update – Stack Overflow and [WayBack] Searching, Downloading, and Installing Updates (Windows).

–jeroen

Posted in Development, Power User, PowerShell, Scripting, Software Development, Windows | Leave a Comment »

esxi listing usb devices on host console: lsusb

Posted by jpluimers on 2019/07/10

Searching for esxi list usb devices on host console did not return meaningful results, but after a few more deeper tries I found that ESXi has lsusb at

Here the difference when connecting another USB hub with devices to an existing ESXi machine:

[root@ESXi-X10SRH-CF:~] lsusb
Bus 001 Device 005: ID 0781:5583 SanDisk Corp. Ultra Fit
Bus 001 Device 004: ID 0557:2419 ATEN International Co., Ltd 
Bus 001 Device 003: ID 0557:7000 ATEN International Co., Ltd Hub
Bus 003 Device 002: ID 8087:8002 Intel Corp. 
Bus 002 Device 002: ID 8087:800a Intel Corp. 
Bus 001 Device 002: ID 0557:2221 ATEN International Co., Ltd Winbond Hermon
Bus 003 Device 001: ID 0e0f:8002 VMware, Inc. 
Bus 002 Device 001: ID 0e0f:8002 VMware, Inc. 
Bus 001 Device 001: ID 0e0f:8003 VMware, Inc. 
[root@ESXi-X10SRH-CF:~] lsusb
Bus 001 Device 010: ID 0409:005a NEC Corp. HighSpeed Hub
Bus 001 Device 009: ID 0922:0019 Dymo-CoStar Corp. LabelWriter 400
Bus 001 Device 008: ID 06bc:0324 Oki Data Corp. 
Bus 001 Device 007: ID 0409:005a NEC Corp. HighSpeed Hub
Bus 001 Device 006: ID 1a40:0101 Terminus Technology Inc. Hub
Bus 001 Device 005: ID 0781:5583 SanDisk Corp. Ultra Fit
Bus 001 Device 004: ID 0557:2419 ATEN International Co., Ltd 
Bus 001 Device 003: ID 0557:7000 ATEN International Co., Ltd Hub
Bus 003 Device 002: ID 8087:8002 Intel Corp. 
Bus 002 Device 002: ID 8087:800a Intel Corp. 
Bus 001 Device 002: ID 0557:2221 ATEN International Co., Ltd Winbond Hermon
Bus 003 Device 001: ID 0e0f:8002 VMware, Inc. 
Bus 002 Device 001: ID 0e0f:8002 VMware, Inc. 
Bus 001 Device 001: ID 0e0f:8003 VMware, Inc.

A few odd things about the devices listed above:

  1. are in none of the /var/log/* files when searching for Oki, Dymo or NEC
  2. are listed differently in Windows:
    • Windows lists the 06bc:0324 Oki Data Corp.  as a “Composite device” with a few sub-devices “MC5(3)x2/ES5(3)4×2” and “USB Printing Support”
    • Windows lists the 0922:0019 Dymo-CoStar Corp. LabelWriter 400 as “USB Printing Support” with a subdevice “DYMO LabelWriter 400”
  3. are listed differently when assigning them to a VM:

Two indispensable tools on Windows for dealing with USB devices are:

They give a much easier to read view than devmgmt.msc, this despite the “hidden devices” trick at [WayBack] Tweak Device Manager for a more Complete View of Devices

Related:

–jeroen

Read the rest of this entry »

Posted in Power User, Virtualization, VMware, VMware ESXi | Leave a Comment »

Applesauce – Make exact images of copy-protected Apple II floppy disks | Hacker News

Posted by jpluimers on 2019/07/08

I might want to try and buy one of these: [WayBack] Applesauce – Make exact images of copy-protected Apple II floppy disks | Hacker News.

A truckload of information is at [WayBack] Applesauce – The ReActiveMicro Apple II Wiki

It is still being updated: [WayBack] applesauce – Apple II Floppy Drive Controller

Via [WayBack] This week, in 6502-related hardware, the Applesauce: a Disk II imaging kit for your Apple II disks. Thanks to the minimal nature of Woz’ disk interface,… – mos6502 – Google+

Related: [WayBack] Confessions of a Disk Cracker: The Secrets of 4am | Hacker News

Videos below the fold…

–jeroen

Read the rest of this entry »

Posted in //e, 6502, Apple, History, Power User | Leave a Comment »

 
%d bloggers like this: