Active Directory cmdlets in PowerShell v6.1.1

November 20, 2018

Richard Siddaway's Blog

Just discovered that you can run the Active Directory cmdlets in PowerShell v6.1.1 BUT there is a huge caveat.

The Windows 10 October 2018 (Windows 10 1809) update includes the RSAT tools (including the AD tools) as optional features. This means that you can easily install the AD tools:

Add-WindowsCapability -Name Rsat.ActiveDirectory.DS-LDS.Tools~~~~0.0.1.0 –Online

The AD PowerShell module now has a 1.0.1.0 version with the PSEdition set as Core,Desk

I’m running the Windows 10 Insider Preview build 18282 which has moved on a bit from Windows 10 1809 and PowerShell Core v6.1.1.

The AD module can be imported and the commands that I’ve tried have worked.

For the AD cmdlets to work in PowerShell Core looks like you need Windows 10 October 2018 update or later and PowerShell v6.1.1 or later. I’m going to say you should upgrade to v6.1.1 if you have v6.1 as the later version fixes a .NET…

View original post 28 more words


So Long, and Congratulations, Mark Minasi (@mminasi)

June 20, 2017

Pester for Presentations – Ensuring it goes ok

May 16, 2017

SQL DBA with A Beard

Whilst I was at PSCONFEU I presented a session on writing pester tests instead of using checklists. You can see it here

During the talk I showed the pester test that I use to make sure that everything is ready for my presentation. A couple of people have asked me about this and wanted to know more so I thought that I would blog about it.

Some have said that I might be being a little OCD about it 😉 I agree that it could seem like that but there is nothing worse than having things go wrong during your presentation. It makes your heart beat faster and removes the emphasis from the presentation that you give.

When it is things that you as a presenter could have been able to foresee, like a VM not being started or a database not being restored to the pre-demo state or being…

View original post 894 more words


Your “WannaCry” Takeaway

May 15, 2017

Security Can’t Just be “No.”

March 17, 2017

Stop Looking Forward

January 12, 2017

Comparing Objects using JSON in PowerShell for Pester Tests

November 3, 2016

Recently I spent the good part of a weekend putting together Pester Tests (click here if you aren’t familiar with Pester) for my LabBuilder PowerShell module- a module to build a set of Virtu…

Source: Comparing Objects using JSON in PowerShell for Pester Tests


Comparing Objects using JSON in PowerShell for Pester Tests

November 3, 2016

PowerShell, Programming and DevOps

Recently I spent the good part of a weekend putting together Pester Tests (click here if you aren’t familiar with Pester) for my LabBuilder PowerShell module- a module to build a set of Virtual Machines based on an XML configuration file. In the module I have several cmdlets that take an XML configuration file (sample below) and return an array of hash tables as well as some hash table properties containing other arrays – basically a fairly complex object structure.

A Pester Test config file for the LabBuilder module A Pester Test config file for the LabBuilder module

In the Pester Tests for these cmdlets I wanted to ensure the object that was returned exactly matched what I expected. So in the Pester Test I programmatically created an object that matched what the Pester Test should expect the output of the cmdlets would be:

What I needed to do was try and make sure the objects were the same…

View original post 569 more words


Server Uptime

October 19, 2016

Richard Siddaway's Blog

Its easy to get the last boot time of a Windows machine but how do you get the uptime

function Get-Uptime {
[CmdletBinding()]
param (
[string]$ComputerName = $env:COMPUTERNAME
)

$os = Get-CimInstance -ClassName Win32_OperatingSystem -ComputerName $ComputerName

$uptime = (Get-Date) – $os.LastBootUpTime

$uptime

}

Use Get-CimInstance to get the Win32_OperatingSystem class. To calculate the uptime subtract the value of LastBootTime from the current time and date.

You’ll get a Timespan object returned.

PS> Get-Uptime

Days : 1
Hours : 10
Minutes : 32
Seconds : 26
Milliseconds : 838
Ticks : 1243468385381
TotalDays : 1.4391995201169
TotalHours : 34.5407884828056
TotalMinutes : 2072.44730896833
TotalSeconds : 124346.8385381
TotalMilliseconds : 124346838.5381

Pick out whichever properties you need for your report

View original post


First release of AutoRuns module

September 22, 2016

>_

You may remember the excellent PowerShell Security series from PowerShell Magazine where I presented a Get-PSAutoRun function to investigate malware persistence ala “Sysinternals autoruns”.

I’ve actually revised its content during the last Christmas holidays and transformed it as a module.

I’ve updated the launch points the original Sysinternals autoruns utility checks and tried to do my best to keep track of what new launch points were added or removed between versions:
AutoRunsHistory
You may have noticed that there’s a new category for Office plugins.
I’ve also added some code about the PoweLiks malware although I hadn’t had yet a sample to fully test my detection code:
Powelik

The code has also undergone a major “quality review” to reduce the number of warnings or issues reported by the PSScriptAnalyzer module.
Test-Code-with-Invoke-ScriptAnalyzer
As you can see, it still complains about using the Get-WmiObject cmdlet and the fact that I sometimes use an empty catch…

View original post 50 more words