Tuesday, 30 January 2018

How do I determine what versions of .NET Framework are installed?

If you are trying to determine what versions of .NET Framework are installed you can use the updated version of XIA Configuration Server.

This can now detect installed versions of the .NET Framework and display them simply grouped by the .NET runtime version without needing to use PowerShell scripting, though you can access this information using our PowerShell API.



You can also use our reporting functionality to view the installed versions across multiple machines from a single report.

Saturday, 20 January 2018

Windows 10 reboots instead of shutting down

Following a Windows update recently my laptop running Windows 10 kept rebooting when I selected to shutdown.


Shutdown the computer from the command line
shutdown /f /s /t 0

- or -

Run regedit and modify the following value to disable fast start
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Power\HiberbootEnabled

Set to zero

Thursday, 18 January 2018

P/invoke CreateProcessWithLogonW causes Error 1058: The service cannot be started, either because it is disabled or because it has no enabled devices associated with it.

If you're running the CreateProcessWithLogonW Win32 API command with P/invoke you may receive the following error

Error 1058: The service cannot be started, either because it is disabled or because it has no enabled devices associated with it.
 
This can occur if the "Secondary Logon" (seclogon) service is disabled in the services control panel. 


Wednesday, 17 January 2018

Can't copy and paste from a Barclays bank statement PDF (SECURED in the title bar)

You might find that when you try and copy and paste from a Barclays bank statement you're no longer allowed to do this. If you're trying to get a reference number out of the document this is infuriating as you end up having to try and copy a 16 digit number by eye, and when doing business accounts doing it many times.

You'll see that there's no copy command when you right click the text



You'll notice the word SECURED in the title bar






This is some nonsensical security added by Barclays.

To resolve this issue do the following


  • Open the PDF file in Google Chrome
  • Click Print
  • Select the destination as Save As PDF
  • Click Save and select a destination
You can now copy from the PDF











Friday, 5 January 2018

Get-Disk PowerShell cmdlet does not show dynamic disks.

We've been updating our Windows server documentation tool to use the newer Get-Disk cmdlets on Windows 2012 and above and found that when you configure a disk as dynamic


The Get-Disk PowerShell cmdlet disappears the disk. It's interesting as the same thing happens in Server Manager. Whilst dynamic disks are deprecated it's still frustrating when things disappear from a user interface rather than showing them as an "Unsupported Disk".


You can however see dynamic disks when using the Get-PhysicalDisk cmdlet

Basic Disk
  • Shows in Disk Management MMC
  • Shows in Get-Disk cmdlet
  • Shows in Server Manager
  • Shows in Get-PhysicalDisk cmdlet
  • Shows in Win32_DiskDrive


Dynamic Disk
  • Shows in Disk Management MMC
  • Doesn't show in Get-Disk cmdlet
  • Doesn't show in Server Manager
  • Shows in Get-PhysicalDisk cmdlet
  • Shows in Win32_DiskDrive


Storage Pool Member Disk
  • Doesn't show in Disk Management MMC
  • Doesn't show in Get-Disk cmdlet
  • Doesn't show in Server Manager
  • Shows in Get-PhysicalDisk cmdlet
  • Doesn't show in Win32_DiskDrive

Storage Pool Virtual Disk
  • Shows in Disk Management MMC
  • Shows in Get-Disk cmdlet as a Microsoft Storage Space Device
  • Shows in Server Manager
  • Doesn't show in Get-PhysicalDisk cmdlet (it's not a physical disk)
  • Does show in Win32_DiskDrive

Friday, 8 December 2017

Get-LocalGroupMember PowerShell cmdlet issues - An unspecified error occurred: error code = 1789

We've recently been working on the new local account management PowerShell cmdlets and found an issue with the Get-LocalGroupMember cmdlet

If a user group has a member that cannot be resolved normally most APIs will return just the SID of the account, and certainly the Computer Management MMC shows the user as the SID and as an unknown account.


Unfortunately the  Get-LocalGroupDetails PowerShell cmdlet fails completely with the following error



 Get-LocalGroupDetails. An unspecified error occurred: error code = 1789

If you use an -ErrorAction SilentlyContinue parameter the cmdlet will return with no members which is obviously misleading as there may be other, valid accounts in the group.



Thursday, 7 December 2017

How to relock a Bitlocker drive after you've unlocked it with PowerShell

If you're using Windows Server 2012 or above you can use PowerShell to relock a bitlocker drive that you have already unlocked

Lock-BitLocker E:

However if the drive is in use you may see this error

Lock-BitLocker : Access is denied. (Exception from HRESULT: 0x80070005
(E_ACCESSDENIED))
At line:1 char:1
+ Lock-BitLocker E:
+ ~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Write-Error], UnauthorizedAcc
   essException
    + FullyQualifiedErrorId : System.UnauthorizedAccessException,Lock-BitLocke
   r
 

This is simple to resolve - simply add the -ForceDismount parameter
Lock-BitLocker E: -ForceDismount