The last time my computer was seen on the network …

was something I wrote about 8 years ago, in Detecting inactive computers in your AD domain.

So it was time to update that*.

Get-ADComputer -Filter * -Properties Name, LastLogonTimeStamp | Select-Object -Property Name, CanonicalName, @{ n = "LastLogonDate"; e = { [datetime]::FromFileTime( $_.lastLogonTimestamp ) } } | Export-CSV -NoTypeInformation "C:\temp\lastlogontimestamp.csv"

will give you a handy list of computer name and the last time they were seen on the network#.

* The Quest product is no longer free.
# within the last 14 days.

PowerShell: Get-ADComputer to retrieve computer last logon date – part 1
Converting LastLogon to DateTime format
Script: LastLogonTimestamp export csv

How I setup my external backup drive.

VeraCrypt128x128I use VeraCrypt to create a encrypted hard drive.  That way, if I lose the drive, the lucky finder won’t be able to read the data.

The steps are as follows:

  1. Using DiskPart and Clean the drive
  2. Start VeraCrypt and select the VeraCrypt Volume Creation Wizard
  3. Encrypt a non-system partition/drive
  4. Standard VeraCrypt volume
  5. Select the external hard drive
  6. Create encrypted volume and format it
  7. Select the default encryption options
  8. Volume size is the entire drive
  9. Select the NTFS Filesystem AND the “Quick Format” option
  10. Click format

Using PowerShell to ZIP something.

powershellI needed to ZIP-up some log files in a number of subdirectories.  In the past, I have used the PKZIP utility.

I couldn’t find my copy of PKZIP Sad smile

“Doesn’t PowerShell have a compress-archive command?”
’Why, yes it does!’

Two commands later:

$files=get-childitem *.log -Recurse
compress-archive $files -DestinationPath c:\data\AllTheLogFiles

I had my AllTheLogFiles.Zip file.

Backup date/time and SyncBackPro

imageMy backup tool of choice is SyncBackPro.  It’s a quality product at a reasonable price.

One of the things I backup is my Apple iPhone and iTunes folders.  I take a snapshot of these by using the Compression feature, with a custom filename.

You can generate a custom filename this by creating your own variable in the Profile Setup/Variables area.

In the screenshot (about) you can see that I’ve created the Variable Name DATETIMENOW with the Value %YEAR%%MONTH%%DAY%_%HOUR%%MINUTE%%SECOND%

In the screenshot, this translates to 20180717_213656

I then use this in the Profile Setup for the actual backup:

As simple as that.

Dell USB-C docks and the Precision laptop range.

dell-universal-dock-d6000-02-pdpSo the Dell Precision 7520/7530 has a USB-C port.  Which you can plug a Dell USB-C dock into it.

And it works well.  Until you close the laptop lid and the laptop decides to Hibernate.

“It’s faulty”, I say to the Dell Engineer.

Some thinking later, the Dell Engineer responds

The Precision laptop requires 180W of power to charge the laptop.
The USB-C output is at a maximum, of 100 watts.  Notice how the battery icon shows that it’s not charging?

The solution, in the words of Dell:

“Systems docked via USB 3.0 Type-A connections or systems that require more than 65 watts power input to power the system and charge the battery will require a separate AC power adapter to power the system and charge the battery.”
Dell Universal Dock (D6000) system charging limitations

Plugging the USB-C dock into the USB-C socket will still allow you to use the dock.

Just not charge from it.

Progressive Alarm Clock

300x0w_003I read “somewhere” that being jolted awake isn’t good for your health.

I’ve noticed that it does make my heart rate spike, so there’s something to that.

I’d heard of gradual alarm clocks being a better way to wake up.  The alarm goes off quietly, and the alarm volume increases over time.

So I looked around and couldn’t find a alarm clock which did this.

“What about an app?”, I thought.

Progressive Alarm Clock was the first iPhone app I found. 

So I’ve tried it for a week, and I’ve found that it is relaxing to be woken up each morning with the ringing of a Tibetan Singing Bowl.  My only dislike is that the user interface looks dated.

There is a cycle of love and death …

“There is a cycle of love and death that shapes the lives of those who choose to travel in the company of animals. It is a cycle unlike any other. To those who have never lived through its turnings and walked its rocky path, our willingness to give our hearts with full knowledge that they will be broken seems incomprehensible. Only we know how small a price we pay for what we receive; our grief, no matter how powerful it may be, is an insufficient measure of the joy we have been given.”

? Suzanne Clothier, Bones Would Rain from the Sky: Deepening Our Relationships with Dogs

Microsoft breaks own application

We had a bunch of newly built Windows 10, version 1607, PCs where App-V 4.6 failed to start.

It was our own fault, App-V 4.6 is not supported on Windows 10.

It did work, until we started using Windows 10 v1607.  An upgrade to v1607 worked fine.  It was a new build where App-V 4.6 didn’t work.

It’s not as if we could ask Microsoft.  Unsupported product is unsupported.

Much Googling occurred to dig up this article
Driver Signing changes in Windows 10, version 1607.

Starting with new installations of Windows 10, version 1607, the previously defined driver signing rules will be enforced by the Operating System, and Windows 10, version 1607 will not load any new kernel mode drivers which are not signed by the Dev Portal. OS signing enforcement is only for new OS installations; systems upgraded from an earlier OS to Windows 10, version 1607 will not be affected by this change.

Existing drivers do not need to be re-signed. To ensure backwards compatibility, drivers which are properly signed by a valid cross-signing certificate issued prior to July 29th, 2015 will continue to pass signing checks on Windows 10, version 1607.

So there is the answer.  We were using App-V 4.6 SP3 HF05.  The sftplaywin81.sys file was signed on 22 September 2016.  Which is later than July 29th, 2015.

We downgraded to HF03, as sftplaywin81.sys was signed on the 16th August, 2014. 

Which fixed the problem of App-V not working.

.Net WiFi Programming

free wifiSome time ago I was asked to write some code to

  1. detect if a user had saved a connection to an Open/Public Wifi point, and
  2. delete it if it exists.

The code had to work on Windows 7, so using the Wi-Fi Direct feature wasn’t available to me.

I could do this using the Native WiFi API, except that doing that from .Net isn’t easy.

So I used the managedwifi wrapper which Monfort Engineering developed and made open source.

Everything worked well except …

The code would occasionally fail.  Much reading of documentation, and lots of head scratching happened.  This was the answer:

“All wireless LAN functions require an interface GUID for the wireless interface when performing profile operations. When a wireless interface is removed, its state is cleared from Wireless LAN Service (WLANSVC) and no profile operations are possible.”
WlanSetProfile function

What that means in practice:

  1. if the Wireless LAN Service is not running, then there is no WiFi running
  2. if the user has disabled the WiFi Adapter, then there is no WiFi to query.

So if 1 or 2 occurred, the code I wrote would fail.

The code to fix that was as simple as this:

Private Sub DeleteOpenWifi()
If wifi.Interfaces.Length = 0 Then
     Exit Sub
End If

How to Avoid Public WiFi Security Risks
About the Native Wifi API
Managed WiFi API (Codeplex)
Is there anyway of detecting what wireless security is being used i.e WPA2, WEP, open etc?