Using the PowerShell Standard Library

This post was originally published on this site

This is the first a set of posts which will help you take advantage of a new Nuget package PowerShellStandard Library 5.1.0. This package allows developers to create modules and applications which host the PowerShell engine which are portable between Windows PowerShell version 5.1 and PowerShell Core 6.0. This means that you can create PowerShell modules and applications which run on Windows, Linux, and Mac with a single binary!

In this post, I’ll walk through the steps for creating a simple binary module which has a single, (very) simple cmdlet. I will also be using the dotnet cli tools for creating everything I need.

First, we need create a project for our new module and create a project template:

PS> New-Item -Type Directory myModule

Directory: C:UsersJamessrcpwsh
Mode LastWriteTime Length Name
---- ------------- ------ ----
d----- 3/26/2018 2:41 PM myModule

PS> Set-Location myModule
PS> dotnet new library
The template "Class library" was created successfully.

Processing post-creation actions...
Running 'dotnet restore' on C:UsersJamessrcpwshmyModulemyModule.csproj...
 Restoring packages for C:UsersJamessrcpwshmyModulemyModule.csproj...
 Generating MSBuild file C:UsersJamessrcpwshmyModuleobjmyModule.csproj.nuget.g.props.
 Generating MSBuild file C:UsersJamessrcpwshmyModuleobjmyModule.csproj.nuget.g.targets.
 Restore completed in 222.92 ms for C:UsersJamessrcpwshmyModulemyModule.csproj.

Restore succeeded.

You can see that the dotnet cli has created a source file and .csproj file for my project. Right now they’re quite generic, but we can add a reference to the PowerShellStandard Library very easily:

PS> dotnet add package PowerShellStandard.Library --version 5.1.0-preview-02
 Writing C:UsersJamesAppDataLocalTemptmp2C8D.tmp
info : Adding PackageReference for package 'PowerShellStandard.Library' into project 'C:UsersJamessrcpwshmyModulemyModule.csproj'.
log : Restoring packages for C:UsersJamessrcpwshmyModulemyModule.csproj...
info : Package 'PowerShellStandard.Library' is compatible with all the specified frameworks in project 'C:UsersJamessrcpwshmyModulemyModule.csproj'.
info : PackageReference for package 'PowerShellStandard.Library' version '5.1.0-preview-02' added to file 'C:UsersJamessrcpwshmyModulemyModule.csproj'.
PS> get-childitem

Directory: C:UsersJamessrcpwshmyModule
Mode LastWriteTime Length Name
---- ------------- ------ ----
d----- 3/26/2018 2:42 PM obj
-a---- 3/26/2018 2:42 PM 85 Class1.cs
-a---- 3/26/2018 2:42 PM 259 myModule.csproj


if we inspect the .csproj file, we can see the reference

PS> Get-Content .myModule.csproj
<Project Sdk="Microsoft.NET.Sdk">
 <PackageReference Include="PowerShellStandard.Library" Version="5.1.0-preview-02" />

We can now implement our cmdlet in the Class1.cs file

PS> get-content Class1.cs
using System;
using System.Management.Automation;

namespace myModule {
  public class GetThingCommand : PSCmdlet {
    protected override void ProcessRecord() {

We can now build, import the dll (as a module) and run our new cmdlet

PS> dotnet build
Microsoft (R) Build Engine version for .NET Core
Copyright (C) Microsoft Corporation. All rights reserved.

Restoring packages for C:UsersJamessrcpwshmyModulemyModule.csproj...
 Restore completed in 164.19 ms for C:UsersJamessrcpwshmyModulemyModule.csproj.
 myModule -> C:UsersJamessrcpwshmyModulebinDebugnetstandard2.0myModule.dll

Build succeeded.
 0 Warning(s)
 0 Error(s)

Time Elapsed 00:00:03.16
PS> import-module .binDebugnetstandard2.0myModule.dll
PS> get-thing

This is a completely portable module, I can load this from PowerShell 5.1 and run it without problem. Of course, we’ve barely scratched the surface, but you can see how this can get you started!

DSC Resource Kit Release March 2018

This post was originally published on this site

We just released the DSC Resource Kit!

This release includes updates to 7 DSC resource modules. In these past 7 weeks, 43 pull requests have been merged and 37 issues have been closed, all thanks to our amazing community!

The modules updated in this release are:

  • SharePointDsc
  • SqlServerDsc
  • xActiveDirectory
  • xComputerManagement
  • xFailOverCluster
  • xNetworking
  • xPSDesiredStateConfiguration

For a detailed list of the resource modules and fixes in this release, see the Included in this Release section below.

Our last community call for the DSC Resource Kit was on March 14. A recording of our updates will be available on YouTube soon. Join us for the next call at 12PM (Pacific time) on April 25 to ask questions and give feedback about your experience with the DSC Resource Kit.

We strongly encourage you to update to the newest version of all modules using the PowerShell Gallery, and don’t forget to give us your feedback in the comments below, on GitHub, or on Twitter (@PowerShell_Team)!

Please see our new documentation here for information on the support of these resource modules.

Included in this Release

You can see a detailed summary of all changes included in this release in the table below. For past release notes, go to the or file on the GitHub repository page for a specific module (see the How to Find DSC Resource Modules on GitHub section below for details on finding the GitHub page for a specific module).

Module Name Version Release Notes
  • SPAlternateURL
    • If resource specifies Central Admin webapp and Default Zone, the existing AAM will be updated instead of adding a new one
  • SPContentDatabase
    • Fixed issue where mounting a content database which had to be upgraded resulted in a reboot.
  • SPDistributedCacheClientSettings
    • Added the new resource
  • SPFarmAdministrators
    • Fixed issue where member comparisons was case sensitive. This had to be case insensitive.
  • SPManagedMetadataServiceApp
    • Fixed issue with creating the Content Type Hub on an existing MMS service app without Content Type Hub.
  • SPManagedMetadataServiceAppDefault
    • Fixed issue where .GetType().FullName and TypeName were not used properly.
  • SPTimerJobState
    • Updated description of WebAppUrl parameter to make it clear that N/A has to be used to specify a global timer job.
  • SPUserProfileServiceApp
    • Fixed issue introduced in v2.0, where the Farm Account had to have local Administrator permissions for the resource to function properly.
    • Updated resource to retrieve the Farm account from the Managed Accounts instead of requiring it as a parameter.
  • SPUserProfileSyncService
    • Fixed issue introduced in v2.0, where the Farm Account had to have local Administrator permissions for the resource to function properly.
    • Updated resource to retrieve the Farm account from the Managed Accounts instead of requiring it as a parameter.
    • The FarmAccount parameter is deprecated and no longer required. Is ignored in the code and will be removed in v3.0.
  • SPVisioServiceApp
    • Fixed an issue where the proxy is not properly getting created
  • Changes to SqlServerDsc
    • Updated the PULL_REQUEST_TEMPLATE with an improved task list and modified some text to be clearer (issue 973).
    • Updated the ISSUE_TEMPLATE to hopefully be more intuitive and easier to use.
    • Added information to ISSUE_TEMPLATE that issues must be reproducible in SqlServerDsc resource module (if running the older xSQLServer resource module) (issue 1036).
    • Updated with a note about sensitive information (issue 1092).
  • Changes to SqlServerLogin
  • Changes to SqlSetup
    • Michael Fyffe (@TraGicCode): Clarify usage of “SecurityMode” along with adding parameter validations for the only 2 supported values (issue 1010).
    • Now accounts containing “$” will be able to be used for installing SQL Server. Although, if the account ends with “$” it is considered a Managed Service Account (issue 1055).
  • Changes to Integration Tests
  • Changes to Unit Tests
  • xADReplicationSite: Resource added.
  • Added xADReplicationSubnet resource.
  • Fixed bug with group members in xADGroup
  • xScheduledTask:
    • Update existing Scheduled Task using SetScheduleTask instead of UnRegister/Register – See Issue 134.
  • Fix master branch AppVeyor badge link URL in README.MD – See Issue 140.
  • Fix deletion of scheduled task with unknown or empty task trigger. Get-TargetResource returns an empty ScheduleType string if the task trigger is empty or unknown – See Issue 137.
  • Added dependency information for xScheduledTask to README.MD.
  • Changes to xFailOverCluster
  • Changes to xClusterNetwork
    • Fix the test for the network role never in desired state (issue 175).
  • Reordered resource list in README.MD to be alphabetical and added missing resource xNetAdapterAdvancedProperty – Fixes issue 309.
  • MSFT_xNetworkTeamInterface:
    • Corrected style and formatting to meet HQRM guidelines.
    • Updated tests to meet Pester v4 guidelines.
    • Converted exceptions to use ResourceHelper functions.
    • Changed unit tests to output Verbose logs.
  • MSFT_xNetAdapterAdvancedProperty:
    • Added a number of additional advanced properties.
    • Fixes issue 314.
  • MSFT_xNetBIOS:
    • Corrected style and formatting to meet HQRM guidelines.
    • Ensured CommonTestHelper.psm1 is loaded before running unit tests.
  • MSFT_xNetworkTeam:
    • Corrected style and formatting to meet HQRM guidelines.
    • Added missing default from MOF description of Ensure parameter.
    • Fixed Get-TargetResource to always output Ensure parameter.
    • Changed unit tests to output Verbose logs.
  • MSFT_xNetConnectionProfile:
    • Corrected style and formatting to meet HQRM guidelines.
  • Updated tests to meet Pester V4 guidelines – Fixes Issue 272.
  • xDSCWebService: Enable SQL provider configuration

How to Find Released DSC Resource Modules

To see a list of all released DSC Resource Kit modules, go to the PowerShell Gallery and display all modules tagged as DSCResourceKit. You can also enter a module’s name in the search box in the upper right corner of the PowerShell Gallery to find a specific module.

Of course, you can also always use PowerShellGet (available in WMF 5.0) to find modules with DSC Resources:

# To list all modules that tagged as DSCResourceKit
Find-Module -Tag DSCResourceKit 
# To list all DSC resources from all sources 

Please note only those modules released by the PowerShell Team are currently considered part of the ‘DSC Resource Kit’ regardless of the presence of the ‘DSC Resource Kit’ tag in the PowerShell Gallery.

To find a specific module, go directly to its URL on the PowerShell Gallery:< module name >
For example:

How to Install DSC Resource Modules From the PowerShell Gallery

We recommend that you use PowerShellGet to install DSC resource modules:

Install-Module -Name < module name >

For example:

Install-Module -Name xWebAdministration

To update all previously installed modules at once, open an elevated PowerShell prompt and use this command:


After installing modules, you can discover all DSC resources available to your local system with this command:


How to Find DSC Resource Modules on GitHub

All resource modules in the DSC Resource Kit are available open-source on GitHub.
You can see the most recent state of a resource module by visiting its GitHub page at:< module name >
For example, for the xCertificate module, go to:

All DSC modules are also listed as submodules of the DscResources repository in the DscResources and the xDscResources folders.

How to Contribute

You are more than welcome to contribute to the development of the DSC Resource Kit! There are several different ways you can help. You can create new DSC resources or modules, add test automation, improve documentation, fix existing issues, or open new ones.
See our contributing guide for more info on how to become a DSC Resource Kit contributor.

If you would like to help, please take a look at the list of open issues for the DscResources repository.
You can also check issues for specific resource modules by going to:< module name >/issues
For example:

Your help in developing the DSC Resource Kit is invaluable to us!

Questions, comments?

If you’re looking into using PowerShell DSC, have questions or issues with a current resource, or would like a new resource, let us know in the comments below, on Twitter (@PowerShell_Team), or by creating an issue on GitHub.

Katie Keim
Software Engineer
PowerShell DSC Team
@katiedsc (Twitter)
@kwirkykat (GitHub)

Forwarding Emails

This post was originally published on this site

When you forward an email to others or copy new people to an email thread, review all the content in the entire email and make sure the information contained in it is suitable for everyone. It is very easy to forward emails to others, not realizing there is highly sensitive information in the bottom of the email that people should not have access to.

Web cam does not show video

This post was originally published on this site

Hello. I hope you all are fine!


Im having a problem with the webcam video (always with usb cams). The VM ware software shown the webcam connected to host and also the SO recognize it (/dev/video0) but its not possible to get video. We need the video to implement a CV software for facial recognition application. And yes, I went to tools->show all usb devices. etc…


it looks like there is a problem with the video buffer. There is a way to troubleshoot it?


Thanks and best regards.