Next Release: PowerShell 7 / .NET Core 3.0

Windows PowerShellFollowing the March 2019 release of PowerShell Core 6.2, the Microsoft PowerShell team announced that Windows PowerShell 5.1 and the PowerShell 6.x Core version will converge into a single version known as PowerShell 7.

Apart from automation across Linux, macOS and Windows, a very high degree of compatibility with existing Windows PowerShell (5.x) modules can be achieved with the next release of PowerShell 7 by leveraging changes in .NET Core 3.0 (such as the return of Out-GridView in Windows).

Unlike the current PowerShell Core support lifecycle, PowerShell 7 will have both LTS (Long Term Servicing) and non-LTS releases which aligns closely with the .NET Core support lifecycle.

PowerShell 7 in Windows is planned to ship as a side-by-side feature with Windows PowerShell 5.1. No information around the PS7 release date in a future version of Windows 10 or Windows Server is available though as the release timelines of .NET Core and Windows do not align.

According to Microsoft, May (2019?) is the likely first Preview release of PowerShell 7 with the generally available (GA) some time after the GA of .NET Core 3.0.

 

 

#powershell #activedirectory *-AD* Cmdlets

Besides the common -Identity parameter, most cmdlets from the Active Directory Module for PowerShell support the -Filter parameter.

If you encounter the following error even though the syntax is correct,

PS C:\> Get-ADGroup -Identity *
Get-ADGroup : Cannot find an object with identity: * under: ‘DC=swissitpro,DC=com’
At line;1 char:1
+ Get-ADGroup -Identity *
+ CategoryInfo : ObjectNotFound: (*:ADGroup) [Get-ADGroup], ADIdentityNotFoundException

simply replace -Identity with -Filter and try again. Obviously this makes sense (and is the only way) to get a list of all defined active directory security and distribution groups in the organisation.

 

 

#powershell TIP: Local vs Remote Background Jobs

It is common to use Start-Job to run a  background job against a remote machine via the -ScriptBlock parameter:

Start-Job -ScriptBlock { param($computer) Get-EventLog -LogName system -ComputerName $computer } -ArgumentList $computer

However, this always runs as a local BackgroundJob, consumes local resources and can be very slow.

Instead, consider using the -AsJob parameter of Invoke-Command to run the task as a RemoteJob on a remote host via -ComputerName i.e.

Invoke-Command -AsJob -ComputerName $computer -ScriptBlock { Get-EventLog -LogName system }

#powershell #skype4b #msexchange List Mismatched Mail(box) Enabled User Email and SIP Addresses

#requires -version 3.0
###############################################################################
# Copyright (c) 201x-2018 leedesmond.com
# All Rights Reserved. Use at your own risk and responsibility.
# Version 1.00
#
# Get a list of mismatched mail(box) enabled user email and SIP addresses
# without SkypeforBusiness or Exchange Server PowerShell modules
#
###############################################################################
# Continue reading “#powershell #skype4b #msexchange List Mismatched Mail(box) Enabled User Email and SIP Addresses”

#powershell SNMP Services Administration (Part 5)

Putting into practice what we have discussed so far, this script illustrates how an administrator can use PowerShell remoting to configure/set SNMP settings on a bunch of Windows machines from a distance.

#requires -version 3.0
###############################################################################
# Copyright (c) 201x-2018 leedesmond.com
# All Rights Reserved. Use at your own risk and responsibility.
# Version 1.00
#
# Configure SNMP settings on multiple Windows machines remotely.
#
# REQUIREMENTS: PowerShell Remoting enabled on target hosts
#
###############################################################################
# Continue reading “#powershell SNMP Services Administration (Part 5)”

#powershell SNMP Services Administration (Part 4)

This script gathers the pieces discussed previously into a reusable PowerShell function Set-SNMP for the purpose of configuring SNMP settings on Windows machines.

#requires -version 3.0
###############################################################################
# Copyright (c) 201x-2018 leedesmond.com
# All Rights Reserved. Use at your own risk and responsibility.
# Version 1.00
#
# Function with self explanatory parameters to configure SNMP settings on
# Windows machines.
#
###############################################################################
# Continue reading “#powershell SNMP Services Administration (Part 4)”

#powershell SNMP Services Administration (Part 2)

Multiple “Community name” and the matching “Trap destinations” can be defined using the Traps tab in the SNMP service. Each community name exists in its own key (node) under:

HKLM:\System\CurrentControlSet\Services\SNMP\Parameters\TrapConfiguration

within which one or more trap destinations are stored as properties (REG_SZ) in this registry location.
Continue reading “#powershell SNMP Services Administration (Part 2)”