PowerShell is Open Sourced

For those of you that have been at PowerShell events over the last few years you’ll have heard Jeffrey Snover state that he wanted to take PowerShell to other platforms.

Now its happened

Jeffrey has announced that an ALPHA release of PowerShell is now available for Linux and Mac.  Currently available for Ubuntu, Centos, Red Hat and Mac OS X with more to come

The announcement is at 

https://azure.microsoft.com/en-us/blog/powershell-is-open-sourced-and-is-available-on-linux/

Also see PowerShell blog

https://blogs.msdn.microsoft.com/powershell/2016/08/18/powershell-on-linux-and-open-source-2/

Some  points to note:

ISE isn’t available as part of the alphas release but VSCode is available for Linux and Mac giving an consistent editor across the platforms

PowerShell remoting will be extended to use Open SSH as well as WSMAN

Planned enhancements include:

Additional Linux Distros covered – parity with .NET Core.

Writing Cmdlets in Python and other languages

PSRP over OpenSSH

WSMan based remoting to downlevel versions of Windows and WSMan based PSRP on Linux.

Editor Services and auto-generated GUI

Unix-style wildcard expansion

Increasing test code coverage for Windows and Linux editions

Continue increasing cmdlet coverage for Linux and Windows

REMEMBER this an ALPHA release – there’s still a lot to do and its a open source project so community effort is required

Enjoy

Posted in PowerShell v5 | Leave a comment

Update-Help errors

Updatable help brings the benefit of up to date help with typos fixed and new edge cases described. The down side is that it sometimes fails:

PS> Update-Help -Force
Update-Help : Failed to update Help for the module(s) ‘Microsoft.PowerShell.Operation.Validation’
with UI culture(s) {en-GB} : Unable to retrieve the HelpInfo XML file for UI culture en-GB. Make sure the HelpInfoUri property in the module manifest is valid or check your network connection and then try the command again.
At line:1 char:1
+ Update-Help -Force
+ ~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ResourceUnavailable: (:) [Update-Help], Exception
    + FullyQualifiedErrorId : UnableToRetrieveHelpInfoXml,Microsoft.PowerShell.Commands.UpdateHelpCo
   mmand

Update-Help : Failed to update Help for the module(s) ‘PSScriptAnalyzer’ with UI culture(s) {en-US} : The Help content at the specified location is not valid. Specify a location that contains valid Help Content.
At line:1 char:1
+ Update-Help -Force
+ ~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidData: (:) [Update-Help], Exception
    + FullyQualifiedErrorId : HelpContentXmlValidationFailure,Microsoft.PowerShell.Commands.UpdateHe
   lpCommand

The failure messages are relatively self-explanatory if you read the details. The problem usually boils down to the needed help files not being available at the URI provided in the module manifest. This often occurs with new modules – the creation of the help files lags well behind the creation of the module usually.

Unfortunately there isn’t much you can do apart from try to find examples of the modules use online

Posted in Powershell Basics | Leave a comment

What you don’t know

 

This article – https://powershell.org/2016/08/08/what-are-your-known-problems-solved-in-dsc/ – started me thinking about the times I’ve worked on big projects.

One of the things we’d do was discuss things that could become problems. Knowledge falls into three groups:

– things you know

– things you don’t know – you know that X is a thing but you don’t know its value

– things you don’t know you don’t know

The last is the one that hurts. Its the things that you don’t know you don’t know that cause the surprises – for example the sudden realisation at 2am that application A won’t install if application B is install. Its not documented and you didn’t know you didn’t know that fact. Now you have to rethink your whole approach.

How do we get round this?

One way is experience – you remember what’s caused problems in the past and you check for those things. Its often said that good judgement comes from experience which comes from bad judgement!

The other way is research. Too many times I’ve seen people assume that something will work because something similar worked in the past. Some bad examples are around treating a new version of Windows the same as the current version or even worse the version you started with 10 years ago.

IT is constantly evolving. One of the things with being a professional (IT pro) is keeping up with your subject. Have you? What don’t you know you don’t know?

Continuing education is going to be a must do activity for IT pros going forward with automation & devops related skills being top of the must learn pile.

Posted in General | Leave a comment

Kindle Fire extinction

Today my Kindle Fire tablet finally stopped working. Its been more than temperamental for the last 12 months – freezing at least once or twice a day, not responding to touch input, not downloading content but today it finally stopped.

Will I buy another one?

No. The whole raft of problems with it freezing seemed to start when Amazon started updating the OS. None of the updates have fixed the problem.

I’ll either revert to my old Kindle that just keeps on working or get something else.

Come on Amazon – you had a great product. It isn’t anymore. Solve the problems and you might get some custom

Posted in General | Leave a comment

PowerShell Summit 2017–Call for Topics

The Call for Topics for PowerShell Summit 2017 is live on powershell.org – https://powershell.org/powershell-and-devops-global-summit-2017-call-for-topics/

Posted in Powershell, Summit | Leave a comment

SysAdmin Day

Today is SysAdmin day – http://sysadminday.com/

Time to show your appreciation for the people who keep your computing going

Posted in IT Community | Leave a comment

.psd1 files

.psd1 files are usually used as module manifests

You can test the manifest

PS>  Test-ModuleManifest -Path ‘C:\Program Files\WindowsPowerShell\Modules\Pester\3.4.0\Pester.psd1’ | fl

Name              : Pester
Path              : C:\Program Files\WindowsPowerShell\Modules\Pester\3.4.0\Pester.psd1
Description       : Pester provides a framework for running BDD style Tests to execute and validate PowerShell commands inside of PowerShell and offers a powerful set of Mocking Functions that allow tests to mimic and mock the  functionality of any command inside of a piece of powershell code being tested. Pester tests can execute any command or script that is accesible to a pester test file. This can include functions, Cmdlets,  Modules and scripts. Pester can be run in ad hoc style in a console or it can be integrated into the Build scripts of a Continuous Integration system.
ModuleType        : Script
Version           : 3.4.0
NestedModules     : {}
ExportedFunctions : {Describe, Context, It, Should…}
ExportedCmdlets   :
ExportedVariables : {Path, TagFilter, ExcludeTagFilter, TestNameFilter…}
ExportedAliases   :

or you can view the whole output

PS>  Test-ModuleManifest -Path ‘C:\Program Files\WindowsPowerShell\Modules\Pester\3.4.0\Pester.psd1’ | fl *

LogPipelineExecutionDetails : False
Name                        : Pester
Path                        : C:\Program Files\WindowsPowerShell\Modules\Pester\3.4.0\Pester.psd1
ImplementingAssembly        :
Definition                  :
Description       : Pester provides a framework for running BDD style Tests to execute and validate PowerShell commands inside of PowerShell and offers a powerful set of Mocking Functions that allow tests to mimic and mock the  functionality of any command inside of a piece of powershell code being tested. Pester tests can execute any command or script that is accesible to a pester test file. This can include functions, Cmdlets,  Modules and scripts. Pester can be run in ad hoc style in a console or it can be integrated into the Build scripts of a Continuous Integration system.
Guid                        : a699dea5-2c73-4616-a270-1f7abb777e71
HelpInfoUri                 :
ModuleBase                  : C:\Program Files\WindowsPowerShell\Modules\Pester\3.4.0
PrivateData                 : {PSData}
Tags                        : {powershell, unit testing, bdd, tdd…}
ProjectUri                  : https://github.com/Pester/Pester
IconUri                     : http://pesterbdd.com/images/Pester.png
LicenseUri                  : http://www.apache.org/licenses/LICENSE-2.0.html
ReleaseNotes                :
RepositorySourceLocation    :
Version                     : 3.4.0
ModuleType                  : Script
Author                      : Pester Team
AccessMode                  : ReadWrite
ClrVersion                  :
CompanyName                 : Pester
Copyright                   : Copyright (c) 2016 by Pester Team, licensed under Apache 2.0 License.
DotNetFrameworkVersion      :
ExportedFunctions           : {[Describe, Describe], [Context, Context], [It, It], [Should, Should]…}
Prefix                      :
ExportedCmdlets             : {}
ExportedCommands            : {[Describe, Describe], [Context, Context], [It, It], [Should, Should]…}
FileList                    : {}
CompatiblePSEditions        : {}
ModuleList                  : {}
NestedModules               : {}
PowerShellHostName          :
PowerShellHostVersion       :
PowerShellVersion           : 2.0
ProcessorArchitecture       : None
Scripts                     : {}
RequiredAssemblies          : {}
RequiredModules             : {}
RootModule                  : Pester.psm1
ExportedVariables           : {[Path, ], [TagFilter, ], [ExcludeTagFilter, ], [TestNameFilter, ]…}
ExportedAliases             : {}
ExportedWorkflows           : {}
ExportedDscResources        : {}
SessionState                :
OnRemove                    :
ExportedFormatFiles         : {}
ExportedTypeFiles           : {}

You can also import the contents of the .psd1 file

PS>  Import-PowerShellDataFile -Path ‘C:\Program Files\WindowsPowerShell\Modules\Pester\3.4.0\Pester.psd1’

Name                           Value                                                                                          
—-                           —–                                                                                          
Copyright                      Copyright (c) 2016 by Pester Team, licensed under Apache 2.0 License.                          
ModuleToProcess                Pester.psm1                                                                                    
PrivateData                    {PSData}                                                                                       
PowerShellVersion              2.0                                                                                            
CompanyName                    Pester                                                                                         
GUID                           a699dea5-2c73-4616-a270-1f7abb777e71                                                           
Author                         Pester Team                                                                                    
FunctionsToExport              {Describe, Context, It, Should…}                                                             
VariablesToExport              {Path, TagFilter, ExcludeTagFilter, TestNameFilter…}                                         
Description                    Pester provides a framework for running BDD style Tests to execute and validate PowerShell co…
ModuleVersion                  3.4.0 

which in some ways is more useful as you can easily see what is actually in the manifets rather than dealing with a lot of empty properties.

You can create .psd1 files to hold other data and read them with Import-PowerShellDataFile. Default parameters for your favourite cmdlets is one thing that comes to mind

Posted in PowerShell v5 | Leave a comment