#pscore6 v.s. #powershell 5.x Modules (Part II)

In the default installation of PowerShell Core 6.0 and Windows PowerShell 5.10 (PS5) with 13 and 89 modules discovered respectively, both PS versions have overlapping module names as illustrated:

CimCmdlets
Microsoft.PowerShell.Archive
Microsoft.PowerShell.Diagnostics
Microsoft.PowerShell.Host
Microsoft.PowerShell.Management
Microsoft.PowerShell.Security
Microsoft.PowerShell.Utility
Microsoft.WSMan.Management
PackageManagement
PowerShellGet
PSDesiredStateConfiguration
PSDiagnostics
PSReadline

An output with similar module names does not always mean that the number and type of commands in each of these modules correspond (see Part I of this blog series). Continue reading

#pscore6 v.s. #powershell 5.x Modules

Because of the cross-platform heterogeneous support design goal in #PsCore6, many platform specific #powershell functionality on the Windows operating system simply cannot, may not or have not yet been migrated over. Since Microsoft does not always fully document details of changes across product versions, this series of blog posts will attempt to identify any similarities and differences between these two PowerShell editions from the command perspective in a typical deployment, namely that of Windows PowerShell 5.x and the newly Release to Manufacturing/Web (RTM/RTW) GA version of PowerShell Core 6.0.0.

Let us kick start with the topic of Modules where the key functionality of PowerShell resides. Out of the box, executing powershell.exe (<= PS5.1) and pwsh.exe (PSCore6) will load a basic set of commands from core modules with exactly the same names:

ModuleType Version Name
———- ——- —-
Manifest 3.1.0.0 Microsoft.PowerShell.Utility
Script 1.2 PSReadline

Even though module names and versions carry the same information, Continue reading

#powershell v6.0 RTM GA Generally Available and Supported

PowerShell Core 6.0.0

  • a new edition of PowerShell #PsCore6
  • built on top of .NET Core “CoreCLR”
  • cross-platform support from Windows, macOS to Linux (direct download)
  • community driven (GitHub) and open-source
  • built for heterogeneous environments and the hybrid cloud
  • works side-by-side with Windows PowerShell[1] (3.0 and later)
  • $PSVersionTable.PSEdition is set to Core
  • process runs as pwsh(.exe) c.f. Windows Powershell = powershell(.exe)
  • default installation path %programfiles%\PowerShell\
  • starts as Administrator in %programfiles%\PowerShell\6.0.0
  • new user profile path $profile = %userprofile%\Documents\PowerShell
  • different $env:PSModulePath
  • not available features – workflow, WMI[2],  Windows Presentation Foundation/Windows Forms, PowerShell ISE[3]
  • Update-Help -force -UICulture “en-us” (help system independent of Windows Powershell)
  • Windows PowerShell 5.10
    = “maintenance” mode
    =  last Windows client/server version i.e.  no new version planned

[1] built on top of .NET Framework 4.x “FullCLR”
[2] use the equivalent *-CIM* cmdlets
[3] use Visual Studio Code + PowerShell plugin

REFERENCES

  1. PowerShell Core 6.0: Generally Available (GA) and Supported!
  2. PowerShell 6.0 Roadmap: CoreCLR, Backwards Compatibility, and More!
  3. Angel Calvo (Twitter): Announcing the GA & Enterprise supported version of #PowerShell Core 6!
  4. Announcing PowerShell for Visual Studio Code 1.0!
  5. What’s New in PowerShell Core 6.0
  6. PowerShell Core Support Lifecycle
  7. PowerShell documentation (en-us)

Zurich Kurs/Course: Windows PowerShell 5.x Basics – Definitiv Start (ab Di. 16. Jan 2018)

Windows PowerShellThe next Windows Powershell 5.x Basics (covers PowerShell Core 6.0) private course IS35.18.12 for a regional bank in Zurich will run in the evenings starting next Tuesday 16 Jan 2018*. If you are interested or have previously registered for the public course IS35.18.11 PowerShell V5.x Einführung (originally start schedule for Tue 9 Jan 2018), you are invited to join and participate in this now open-to-public course instead.

Contact a EB-Zürich staff member or check online for more information today!

*
Dienstag 16.01.2018 18:00-21:30
Dienstag 23.01.2018 18:00-21:30
Dienstag 30.01.2018 18:00-21:30
Dienstag 06.02.2018 18:00-21:30
Dienstag 13.02.2018 Sportsferien
Dienstag 20.02.2018 Sportsferien

Dienstag 27.02.2018 18:00-21:30
Dienstag 06.03.2018 18:00-21:30
Dienstag 13.03.2018 18:00-21:30
Dienstag 20.03.2018 18:00-21:30

Zurich Kurs/Course: Windows Server 2016 Basics – Definitiv Start (ab Do. 18. Jan 2018)

Der erste, beliebte Windows Server 2016 Basics Kurs (IS36.18.11) dieses Jahres wird am Do. 18. Jan 2018 für insgesamt 6 Abende* in Zürich West, Technopark planmässig beginnen.

Sichern Sie Ihre Plätze zu diesem praxisnahen Microsoft Training für effizientes Betrieb Ihrer On-premise, Hybrid oder Cloud Datacentrelösungen heute noch!

Mehr Information und Anmeldung finden Sie hier.

*
Donnerstag 18.01.2018 18:00-21:30
Donnerstag 25.01.2018 18:00-21:30
Donnerstag 01.02.2018 18:00-21:30
Donnerstag 08.02.2018 18:00-21:30
Donnerstag 15.02.2018 Sportsferien
Donnerstag 22.02.2018 Sportsferien
Donnerstag 01.03.2018 18:00-21:30
Donnerstag 08.03.2018 18:00-21:30

#powershell Temporary Files

Introduced in PowerShell 5.0, the New-TemporaryFile cmdlet creates a single ‘scratch’ file with the tmp file extension in a user’s $env:temp directory. For previous #powershell versions, you can do this directly with .NET Framework:

$tempfile = [system.io.path]::GetTempFileName()

Likewise, this has the tmp file extension and is automatically placed in $env:temp. Assigning to a variable permits quick access.

Alternatively, you can create a unique file name for temporary usage by taking advantage of your system date/time as depicted:

$d = Get-Date
$d1 = $d.date.ToShortDateString() -replace “:|/|-|\.”
$d2 = $d.TimeOfDay.ToString() -replace “:|\|-|\.”
$tempfile = “$env:temp\” + $d1 + $d2 + “.tmp”
$tempfile

#powershell Auto Type Conversion – String Array Concatenation

$a1 = “apple”
$a2 = “pear”, “guava”

# add/join 2 string arrays together
[array]$fruits = $a1 + $a2
$fruits
# applepear guava
# $a1 is a simple string type;
# $a2 string array auto expanded and added to same string object

$fruits.count #1 unique string
$fruits.GetType() #a single unit of string array

# one correct way to add/join 2 string arrays together
# force conversion of $a1 simple string to a string array
$fruits = @($a1) + $a2
$fruits
<#
apple
pear
guava
#>

$fruits.count #3 items in array
$fruits.GetType() #an array of strings

$fruits[1]
# pear

#alternative if the order is not important
$fruits = $a2 + $a1
$fruits
<#
pear
guava
apple
#>

$fruits.GetType() #an array of 3 strings

#skype4b Audit Change Tracking Management?

With the right administrative permissions, a #skype4b administrator can add new or modify existing policies and global configuration settings. Every team member is happy when things go according to plan. If a system-wide or scope-level setting[1] goes awry, your end-users will likely be your most reliable “first level alarm” system. In this case, any remedial actions will visibly affect respective services or users in the firm.

Likewise, a Skype for Business enabled user… Continue reading

#powershell Get-Date v.s. [datetime] Format and System Locale

When a datetime attribute, say whenChanged in Active Directory gets dump to a text file via Export-Csv, the actual object type stored is that of a string. The format saved is dependent on the system locale. Typically for non en-us western locales, the day precedes the month instead of vice versa.

To convert this back to the proper datetime format through Import-Csv, use… Continue reading

#powershell Set-SmbShareAccess ?

Grant-SmbShareAccess is the go-to cmdlet to assign and modify permissions granted to trustees on a Windows NT file share as no Set-SmbShareAccess equipvalent exists.

NOTE
*-SmbShareAccess and related cmdlets are available in PowerShell 4 and higher (Module: SmbShare) and are delivered only with operating systems Windows 8 and Windows Server 2012 (and later versions).