header image

Archive for November, 2017

Get Folder sizes

Posted by: | November 29, 2017 Comments Off on Get Folder sizes |

One problem that comes up quite often is how do you get folder sizes. One option is use Measure-Object but the problem with that approach is that its going to be a pretty slow process if you have a lot of folders. PowerShell doesn’t have a method of directly getting the folder size and you […]

under: File System, PowerShell

Windows update module

Posted by: | November 28, 2017 Comments Off on Windows update module |

A Windows Update module is available on Windows versions 1709 and later. This includes Windows 10 Fall Creators Update, Windows Server 1709 and Windows Insider previews (Server and Client) post the 1709 release. The module supplies the following cmdlets Get-WUAVersion Get-WUIsPendingReboot Get-WULastInstallationDate Get-WULastScanSuccessDate Install-WUUpdates Start-WUScan The module is a CDXML module based on the root/Microsoft/Windows/WindowsUpdate/MSFT_WUOperations […]

under: Windows 10, Windows server 1709

Get an AD user’s manager

Posted by: | November 27, 2017 Comments Off on Get an AD user’s manager |

Interesting question on the forum about finding the manager for a given user in AD – assuming the Manager field is populated of course. If you’ve not worked with the AD cmdlets this is a good introduction to some of their quirks. This is how you get an AD user’s manager.   You need the […]

under: PowerShell and Active Directory

PowerShell v6: #5 Get-Uptime

Posted by: | November 23, 2017 Comments Off on PowerShell v6: #5 Get-Uptime |

One new feature of PowerShell v6 (its actually been available since alpha 13 but I’d missed it) is the Get-Uptime cmdlet   PS C:\scripts> Get-Uptime Days              : 0 Hours             : 2 Minutes           : 57 Seconds           : 6 Milliseconds      : 0 Ticks             : 106260000000 TotalDays         : 0.122986111111111 TotalHours        : 2.95166666666667 TotalMinutes      : 177.1 TotalSeconds      : 10626 […]

under: PowerShell v6

PowerShell v6: #4 profiles

Posted by: | November 23, 2017 Comments Off on PowerShell v6: #4 profiles |

Windows PowerShell (v1-v5.1) has always used profiles to configure your PowerShell session.  You need execution policy set to something other than restricted so that the profile script can run.   You can have up to 4 profiles: Description                Path ———–                —- Current User, Current Host $Home\[My ]Documents\WindowsPowerShell\Profile.ps1 Current User, All Hosts    $Home\[My ]Documents\Profile.ps1 All Users, […]

under: PowerShell v6

PowerShell v6: #3 Release Candidate

Posted by: | November 20, 2017 Comments Off on PowerShell v6: #3 Release Candidate |

The PowerShell team have announced the availability of the PowerShell v6 release candidate. https://blogs.msdn.microsoft.com/powershell/2017/11/17/powershell-core-6-release-candidate/   A release candidate is just about done with only bugs to resolve – in other words about what you can expect in the final delivery.   Some work is still required – https://github.com/PowerShell/PowerShell/issues?q=is%3Aopen+is%3Aissue+milestone%3A6.0.0-GA   The full release of PowerShell 6.0 […]

under: PowerShell v6

Cannot verify the file SHA256 when installing package

Posted by: | November 18, 2017 Comments Off on Cannot verify the file SHA256 when installing package |

I’m doing some work requiring containers and decided to use Server 1709 as it has some significant changes when compared to Server 2016. The documentation – https://docs.microsoft.com/en-us/virtualization/windowscontainers/about/ – just gives options for Windows Server 2016 and Windows Server Insider Preview. As 1709 is the shipping version of the Insider Preview I decided that should work. […]

under: Containers, Windows server 1709, Windows Server 2016

Windows update change in Server 1709

Posted by: | November 17, 2017 Comments Off on Windows update change in Server 1709 |

When Windows Server 2016 was introduced a very nice CIM class was provided to work with Windows Updates. If you wanted to scan for available updates you could do something like this: $ci = New-CimInstance -Namespace root/Microsoft/Windows/WindowsUpdate -ClassName MSFT_WUOperationsSession  <br>$result = $ci | Invoke-CimMethod -MethodName ScanForUpdates -Arguments @{SearchCriteria=”IsInstalled=0″;OnlineScan=$true} <br>$result.Updates   Unfortunately, if you try this […]

under: Windows server 1709, Windows Server 2016

When is PowerShell not PowerShell?

Posted by: | November 14, 2017 Comments Off on When is PowerShell not PowerShell? |

When is PowerShell not PowerShell? When its PowerShell v6.   This applies to beta 9 and later   Check a v6 instance PS C:\Program Files\PowerShell\6.0.0-beta.9> $PSVersionTable Name                           Value —-                           —– PSVersion                      6.0.0-beta.9 PSEdition                      Core GitCommitId                    v6.0.0-beta.9 OS                             Microsoft Windows 10.0.17035 Platform                       Win32NT PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…} PSRemotingProtocolVersion      2.3 SerializationVersion           1.1.0.1 WSManStackVersion              3.0 Now try […]

under: PowerShell v6

PowerShell version

Posted by: | November 14, 2017 Comments Off on PowerShell version |

Depending on the version of Windows you’re running you could be using PowerShell version 1 through version 5.1 (admittedly I suspect there are very few people, if any, still running PowerShell v1). This is complicated by the various versions of Windows Management Framework that are available for download and the large number of alpha and […]

under: PowerShell

Older Posts »

Categories