Profile Power: Default Parameter for Format-Table and Format-Wide

I’m lazy. When I run Format-Table and Format-Wide, the effort of typing -A and pressing Tab to give me -AutoSize weighs heavy on my fingers! And, so it is that I use the $PSDefaultParameterValues variable, in my PowerShell profile, to automatically add the -AutoSize parameter every time I run Format-Table or Format-Wide.   $PSDefaultParameterValues[‘Format-[wt]*:Autosize’] = $true   And, it’s…

0

Get Active Directory Write Members WriteProperty

A messaging colleague asked how to check which principals have the Write Members permission on distribution lists. I sent him a sample of how to query the WriteMember WriteProperty of a distribution group imaginatively called, er, DistributionGroup…     #Get WriteMember WriteProperty $WriteMemberGuid = “bf9679c0-0de6-11d0-a285-00aa003049e2” (Get-Acl -Path “AD:CN=Distribution Group,OU=Groups”).access | Where-Object {($_.ActiveDirectoryRights -eq “WriteProperty”) -and ($_.ObjectType…

0

Profile Power: Tidy Up My Personal Certificate Store

I’ve decided to do a few posts on the contents of my PowerShell profile. A profile is a script that runs when your PowerShell console starts. There is a profile for the ISE and the standard console. You can find the script location by looking at the $profile variable of the current host.   What’s in…

0

Security Focus: Count Vulnerabilities for Monthly Security Updates

Having a monthly single Security update makes sense. Have a cumulative quality update also makes sense. For example, two weeks ago, a customer was responding to the WannaCrypt outbreak by applying the May 2017 Monthly roll-up. Not only were the clients getting patches reaching back to October 2016, they were also getting improvements and fixes back…

2

Security Focus: Get CVE Information for WannaCrypt

You’ve no doubt heard that the WannaCrypt ransomware is also a worm. The propagation code exploits a patched SMB vulnerability – CVE-2017-0145. How can we use PowerShell to create a Common Vulnerabilities and Exposures (CVE) report for that vulnerability?   Set-MSRCApiKey -ApiKey XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX $cvrfDoc = Get-MsrcCvrfDocument -ID 2017-Mar $Properties = @{ Vulnerability = ($cvrfDoc.Vulnerability | Where-Object…

0

DNS Forwarders Fours Ways

I’m lucky enough to occasionally eat in nice restaurants. A lot of the time, the menu makes for interesting (and pretentious) reading. One may see things along the lines of: Deconstructed green forest gateaux Condensed cauliflower cheese cake Themes of cucumber on a medley of mangoes Wafts of autumn mushroom mist Everything-tastes-like-chicken three ways   And, so taking inspiration from…

0

Set Password of Azure Active Directory B2B User to Not Expire with PowerShell

First up, non-expiring passwords aren’t recommended… but, what if you did want to set an AAD user to have a non-expiring password? Furthermore, what if you wanted to target a B2B user?   Here’s how I get a list of my B2B users, that have a display name starting with Ian, that also have their…

0

Periodically Check PowerShell Job Status

My PowerShell profile starts a load of PowerShell jobs when I’m running as Administrator… Sometimes I need to know when those jobs have finished. Here’s a lovely little infinity loop giving me just that information.   while ($true) {Write-Output ” “; start-sleep 10; get-job; write-output ” “}   Here’s what it comes back with…  …

1

Use PowerShell to List Active Directory Extended Rights

PowerShell providers allow us to traverse various data stores we encounter, as IT professionals, as if they were file systems. There is a PSProvider that allows us to navigate the smooth seas of the Active Directory PSDrive.     Thinking about a file system, we can talk about Access Control Entries (ACEs) that make up Access Control Lists (ACLs) to govern…

0