#powershell Get List of Two-letter Country ISO 3166 Code (alpha-2), Currency, Language and more

#requires -version 3.0
################################################################################
# Copyright (c) 201x-2018 leedesmond.com
# All Rights Reserved. Use at your own risk and responsibility.
# Version 1.00
#
################################################################################
#
$AllCultures = [System.Globalization.CultureInfo]::
GetCultures(
[System.Globalization.CultureTypes]::
SpecificCultures) # !AllCultures
Continue reading “#powershell Get List of Two-letter Country ISO 3166 Code (alpha-2), Currency, Language and more”

#skype4b Reset Presence Status with PowerShell (and LyncSdk)

UPDATE
#skype4b #powershell Auto Enforce User-defined Lync/Skype Presence Status

———-
You may notice that since the launch of Lync 2010 client to the latest Skype for Business 2016 (desktop) client, user’s manually configured Presence Status automatically reverts to Available after some predetermined time-out period [1]. This is unlike system managed status such as In a call or In a conference* which remains unchanged as long as the session is active (even with a locked computer).

To regain control over presence status set explicitly by hand, you can deploy PowerShell in combination with … Continue reading “#skype4b Reset Presence Status with PowerShell (and LyncSdk)”

#skype4b Set Presence Idle Away Threshold with PowerShell

The majority of client-side settings in Skype for Business 2016 client are controlled in-band whereas certain parameters continue to be configured using Group Policy (centrally in an AD environment). The latter essentially writes to the corresponding key/value pair in the Windows registry for each user in HKCU:.

One such popular setting is the Away status. Because both Active Directory Computer and User Group Policy are applied at computer start/user log on, and automatically refreshes every 90 minutes in the background by default (+30 minutes random offset), manual configuration of this setting will be overwritten eventually.

To workaround this constraint … Continue reading “#skype4b Set Presence Idle Away Threshold with PowerShell”

Zürich PowerShell Training Kurs/Course (from May 2017)

PowerShellThe bad news is that I will miss another year of PowerShell Europe Conference in Hanover, Germany (2 – 5 May 2017). The very excellent news though is that I shall deliver and teach a private PowerShell 5.x course* to the biggest number one Swiss bank in the country, ranked as one of the top Fortune 500 global financial services institution worldwide.

How can I participate in or organize private (customized) lessons then? Simple really. Contact me for more information today. Or you can sign-up for any of my popular public PowerShell, Microsoft Windows Server 2016, MCSA certificate or specialized cloud training classes covering beginners to advanced levels:

  • Kurs: PowerShell V5.x – Einführung / Basics (link)
    Next (evening) class start Wed 10. May 2017
  • Kurs: PowerShell V5.x – Aufbau / Advanced (link)
    Next (evening) class start Wed 30. Aug 2017
  • Office 365, Azure, Exchange/Skype for Business Server, PowerShell Automation, etc. (contact)
  • Others

I look forward to work with you on training or consultancy engagements in your language (English, German, 中文, etc.) from Zurich, Switzerland to pretty much anywhere in the world.

#PowerShell #ITPros #Events #Training @ebzuerich

* hence the apparent quietness online

HELP: PowerShell 5.1 / 5.0 What’s New (and More) – Part 5 Functions

Many new functions were introduced or “reborn” as functions (where life started as cmdlets or vice versa) in PowerShell 5.0. Find-Command and Find-RoleCapability are the only 2 additions in PS 5.1 which brings the total function count to 59 for a default installation of Windows Server 2016 RTM (en-us).

PS 5.0

PS 5.1

Compress-Archive

Compress-Archive

ConvertFrom-SddlString

ConvertFrom-SddlString

Disable-DscDebug

Disable-DscDebug

Disable-NetworkSwitchEthernetPort

Disable-NetworkSwitchEthernetPort

Disable-NetworkSwitchFeature

Disable-NetworkSwitchFeature

Disable-NetworkSwitchVlan

Disable-NetworkSwitchVlan

Enable-DscDebug

Enable-DscDebug

Enable-NetworkSwitchEthernetPort

Enable-NetworkSwitchEthernetPort

Enable-NetworkSwitchFeature

Enable-NetworkSwitchFeature

Enable-NetworkSwitchVlan

Enable-NetworkSwitchVlan

Expand-Archive

Expand-Archive

Export-ODataEndpointProxy

Export-ODataEndpointProxy

Find-Command

Find-DscResource

Find-DscResource

Find-Module

Find-Module

Find-RoleCapability

Find-Script

Find-Script

Format-Hex

Format-Hex

Get-DscConfigurationStatus

Get-DscConfigurationStatus

Get-InstalledModule

Get-InstalledModule

Get-InstalledScript

Get-InstalledScript

Get-NetworkSwitchEthernetPort

Get-NetworkSwitchEthernetPort

Get-NetworkSwitchFeature

Get-NetworkSwitchFeature

Get-NetworkSwitchGlobalData

Get-NetworkSwitchGlobalData

Get-NetworkSwitchVlan

Get-NetworkSwitchVlan

Get-PSRepository

Get-PSRepository

Get-SilComputerIdentity

Get-SilComputerIdentity

Import-PowerShellDataFile

Import-PowerShellDataFile

Install-Module

Install-Module

Install-Script

Install-Script

New-Guid

New-Guid

New-NetworkSwitchVlan

New-NetworkSwitchVlan

New-ScriptFileInfo

New-ScriptFileInfo

New-TemporaryFile

New-TemporaryFile

Publish-Module

Publish-Module

Publish-Script

Publish-Script

Register-PSRepository

Register-PSRepository

Remove-DscConfigurationDocument

Remove-DscConfigurationDocument

Remove-NetworkSwitchEthernetPortIPAddress

Remove-NetworkSwitchEthernetPortIPAddress

Remove-NetworkSwitchVlan

Remove-NetworkSwitchVlan

Restore-NetworkSwitchConfiguration

Restore-NetworkSwitchConfiguration

Save-Module

Save-Module

Save-NetworkSwitchConfiguration

Save-NetworkSwitchConfiguration

Save-Script

Save-Script

Set-NetworkSwitchEthernetPortIPAddress

Set-NetworkSwitchEthernetPortIPAddress

Set-NetworkSwitchPortMode

Set-NetworkSwitchPortMode

Set-NetworkSwitchPortProperty

Set-NetworkSwitchPortProperty

Set-NetworkSwitchVlanProperty

Set-NetworkSwitchVlanProperty

Set-PSRepository

Set-PSRepository

Stop-DscConfiguration

Stop-DscConfiguration

Test-ScriptFileInfo

Test-ScriptFileInfo

Uninstall-Module

Uninstall-Module

Uninstall-Script

Uninstall-Script

Unregister-PSRepository

Unregister-PSRepository

Update-DscConfiguration

Update-DscConfiguration

Update-Module

Update-Module

Update-ModuleManifest

Update-ModuleManifest

Update-Script

Update-Script

Update-ScriptFileInfo

Update-ScriptFileInfo

Hyper-V: The operation cannot be performed while the object is in use (Windows Server 2016 / Windows 10)

You have a number of virtual machines running on your Windows Server 2016, Windows 10 or Windows Server 2008 R2 Hyper-V system. As soon as you try to start another VM in the Hyper-V Manager console or Start-VM virtmachine via PowerShell, a rather cryptic message keeps preventing you from doing so:

[Window Title]
Virtual Machine Connection

[Main Instruction]
The application encountered an error while attempting to change the state of ‘virtmachine’.

[Content]
‘virtmachine’ failed to change state.

The operation cannot be performed while the object is in use.

[Close]

To resolve this, disassociate any other VM from “Physical CD/DVD device” under media before you retry the operation on the failed VM.

HELP: PowerShell 5.1 / 5.0 What’s New (and More) – Part 4 Variables

The good news about system variables in Windows PowerShell is that only one new (preference) variable $InformationPreference is added starting with PS 5.0. It has a default value of SilentlyContinue and is listed in the about_Preference_Variables Help file (PS 5.1). You use this mainly to control how the new PS 5.x Write-Information cmdlet behaves. Of note is that Write-Host is a wrapper for Write-Information beginning with PS 5.0. However, the $InformationPreference variable only affects the latter cmdlet.

Desired State Configuration is a new feature introduced in PowerShell 4.0. The about_Automatic_Variables help file in PS 5.1 lists this $AllNodes variable where it automatically becomes available in the scope of a DSC configuration document when passed using the -ConfigurationData parameter. As a side note, you may be interested to know that development of DSC resources using the new class feature is possible starting in PS 5.0.

REFERENCES

– Writing a custom DSC resource with PowerShell classes (TechNet)

 

Hyper-V: Virtual Machine failed to change state (Windows Server 2016 / Windows 10)

When you try to Apply a previously saved Checkpoint (snapshot) to a virtual machine in Hyper-V running Windows Server 2016, Windows 10 or Windows Server 2012 R2, a bizarre error message consistently appears even with full administrative rights on the machine:

[Window Title]
Virtual Machine Connection

[Main Instruction]
The application encountered an error while attempting to change the state of ‘virtmachine’.

[Content]
‘virtmachine’ failed to change state.

The operation is not supported.

[Close]

If restarting the “Hyper-V Virtual Machine Management” (vmms) and “HV Host Service” (HvHost) service does not help, a cold machine reboot should fix this rather strange issue.

HELP: PowerShell 5.1 / 5.0 What’s New (and More) – Part 3 Modules

In the last installment of this Windows PowerShell HELP series, you learnt about the new cmdlets introduced in both PS 5.0 and 5.1. But where do they actually come from?

A module is essentially a data repository which groups all relevant cmdlets, functions and commands under one roof. Since PS 3.0, the mere act of running a cmdlet will cause Windows PowerShell to load the corresponding module without administrative intervention. To make this work, modules must be placed in a location listed in $env:PSModulepath. Because of this automatic module loading feature, an administrator does not always need to know exactly in which module a particular command resides[1]. By changing the $PSModuleAutoLoadingPreference preference variable, you can enable, disable and configure automatic importing of modules.

For a default Windows Server 2012 R2 (PS 4.0) installation, a total of 63 modules are available for use. The addition …

Continue reading “HELP: PowerShell 5.1 / 5.0 What’s New (and More) – Part 3 Modules”

HELP: PowerShell 5.1 / 5.0 What’s New (and More) – Part 2 Cmdlets

At the core of Windows PowerShell is the various sets of cmdlets designed to accomplish specific tasks, much like Control Panel applets (since Windows 3.x) and today’s modern Apps on desktop and mobile devices.

The number of cmdlets has grown significantly at each new release of PowerShell. For instance, the default installation of Windows Server 2016 RTM (en-us) makes 634 cmdlets available which are spread across 41 modules. Updating Windows Server 2012 R2 (PS 4.0) with the corresponding version of WMF 5.x results in 39 and 60 cmdlets added in PS 5.0 and 5.1 respectively. If you do the math(ematics), an additional 21 new cmdlets were introduced between the 5.0 and 5.1 releases. These deal mainly with the management of file catalog, local user/group, time zone and miscellaneous ones like Get-ComputerInfo.

Note that in pre- Windows Server 2016 and Windows 10 Anniversary Update systems …

Continue reading “HELP: PowerShell 5.1 / 5.0 What’s New (and More) – Part 2 Cmdlets”