#PSTweetChat – The EU Edition


If you have been involved in the #PSTweetChat events that have been running with Adam Bertram (@adbertram) & Jeffery Hicks (@JeffHicks) and a number of others, then you would be aware of just how awesome these 1-hour open discussion sessions truly are.

A number of PowerShell Questions get asked and answered from members of the PowerShell community worldwide so they can become a valuable resource to getting a right answer to an issue quickly or even just learning more about the people that make the awesome community and what they are currently up to this week.

So after a discussion about this with Adam Bertram & Jeffery Hicks on a previous #PSTweetChat I had said that I would co-ordinate a #PSTweetChat that was more EU time friendly – Well I am announcing that the EU #PSTweetChat will be monthly on the 3rd Friday of the month starting on February 19th at 10am UTC 0

This will be the case for February & March and then in April (due to the Time changes to the Clocks) we will move to 10am UTC +1

So the dates will be (mark them in your calendar)

  • February 19th – 10am UTC 0
  • March 18th – 10am UTC 0
  • April 15th – 10am UTC +1
  • May 20th – 10am UTC +1
  • June 17th – 10am UTC +1
  • July 15th – 10am UTC +1
  • August 19th – 10am UTC +1
  • September 16th – 10am UTC +1
  • October 21st – 10am UTC +1
  • November 18th – 10am UTC 0
  • December 16th – 10am UTC 0

I will look forward to the future #PSTweetChat conversations.

Published: 27/01/2016 15:14

Get-PSUGUK – Call for Speakers

The UK PowerShell User Groups (Get-PSUGUK) are undergoing an expansion with some new User Groups being sprung up across the UK over the upcoming months.

If you have been able to attend any of the previous events (Manchester & London) then you will know that I’m a big advocate for making a real community out of the User Group Meet ups – one where there is the opportunity for those from all differing IT backgrounds to rise up and present a topic to their local User Group.

With the number of differing PowerShell related Topics that there are available there should be no shortage of possible topics and there will be availability for a variety of different formats including short 15-minute Lightning presentations, 45-minute Presentations and even possibility for a full evening presentation.

With this in mind we are putting forward a Call for Speakers for the year ahead which if you are interested in presenting a topic then we have an Excel Survey that you can fill in located at http://1drv.ms/1OVuqul – please note that we are not currently looking delivering sessions remotely.

Myself and the fellow organisers, Corey Burke (@cburke007), Iain Brighton (@IainBrighton) & Richard Siddaway (@RSiddaway) will look forward to seeing you at future User Group Events and would like to invite you to follow @GetPSUGUK on Twitter for updates on the PowerShell User Group Events in Future.

To Sign up for the Manchester User Group on Feb 1st please follow this link – http://www.eventbrite.co.uk/e/get-psuguk-manchester-february-tickets-20117867082

To Sign up for the London User Group on Feb 4th please follow this link – http://www.eventbrite.co.uk/e/get-psuguk-february-london-tickets-20727283864

To see future events (including new cities as they occur) please bookmark this link – http://get-psuguk.eventbrite.com/


My Workflow for Using Git with Github – pt3

So this is Part 3 of a series of Blog Posts on my (currently ever changing) Workflow with Git, Github & PowerShell.

Hopefully you have had chance to look at the previous posts in this series if not they are

Part 1

Part 2

However, for this post we will be concentrating on Script & Module Creation and how we can make the overall experience more efficient with the PSISE_Addons module that I’m releasing on Github https://github.com/kilasuit/ISE_Cew

We will cover the following items today

  • Use of PSDrives for the functions & why you should use them in this case
  • Use of Git for the source control in this module – Simple and hopefully clear to follow and not too in depth
  • The Functions used in this module
  • Creating compliant PSD1 files for the PowerShell Gallery – Because it’s annoying to have to do this manually and that’s why we automate right – Again added in this Module is an example!
  • Creating some basic Pester Tests – again without even thinking about it as I am giving this to you as part of the ISE_Cew Module!


So firstly – Using PSDrives within the Function and why to use them.

PSDrives are a good and simple way of having a location that you can reach only in PowerShell and can use a variety of Different Providers – FileSystem, ActiveDirectory etc

We will be using the FileSystem Provider in this example for our functions.

So I begin with a Few PSDrives created in my PowerShell Profile As you can see below – I use 1 profile and encapsulate an if Statement to check if the host is the PowerShell ISE for ISE only Functions – like the 3 I will be showing you today.





As you can see I Have a PSDrive for all the following OneDrive, Github, Scripts, Scripts-WIP, Modules & Modules-WIP

The Important bit here is that all my Github Repo’s are actually stored in my Personal OneDrive as you can see from the above image – this means that I can Switch between Devices Very Very Quickly once things are saved 😉 – It’s probably key to point out this could be your OneDrive For Business Location as well or a Shared Drive if you are in an organisation that uses HomeDrive locations. The Possibilities are endless – save your imagination.

So from here we have our PSDrives set up and the beauty of this is that it allows very simple navigation between repo’s as you have them all centralised. In my Next Post I will be showing you how you can populate this Github Location with all your Repo’s that you have Forked and how you can ensure that all repo’s are up to date and have the latest updates pulled into them or commits pushed from them in just a few functions! So stay tuned for that!

Hopefully this will leave you with a reason to adopt PSDrives into your workflow and we can move onto the next section.

Use of Git for Source Control in this module

Quick intro – Git can be used with your own offline Repo’s – It doesn’t need to be linked to a Github Repo however this is most common and I would recommend that you use Github – You can get 5 Private Repo’s for only $7 USD a month (about £4 odd)

For more information on Git for Source Control if you are new to it I would recommend having a look at this series on PowerShellMagazine http://www.powershellmagazine.com/2015/07/13/git-for-it-professionals-getting-started-2/ – that was how I got started and also have a play with the “Learn Git in your Browser” on http://try.github.com/ – it’s definitely a useful starting point and will help you out in your future endeavours.

So the Key Git commands used in this module are

  • Git add – Simply adds files to be watched under the git version control system
  • Git commit – commits a version change to the repository location for the files

Other Key Git commands

  • git push – pushes new commits to the remote repository (this could be hosted on Github)
  • git pull – Pulls changes from the remote repostitory (this could be hosted on Github)
  • git clone – clones the remote repository to your own machine (this could be hosted on Github)

So that’s the key commands out of the way but why and when will we want to use them or in our case not think about using them.

The Functions used in this Module


For me I’m a bit data-centric (aka a data hoarder) – I prefer to have too much data than not enough. So to cover this I wanted a way to Auto Commit Any changes to Scripts and Modules every time I saved them

So this is where creating this module came in – and the functions contained within.

I have created 3 Core functions

  • Save-CurrentISEFile -Saves Current File that is Open in ISE whether it has been previously Saved or not
  • Save-AllNamedFiles – Saves all Files that have previously been saved
  • Save-AllUnnamedFiles – Saves All files that have not been previously save

And also 2 helper Functions

  • Request-YesOrNo (amended from the one included in SPPS – thanks to @Jpaarhuis)
  • Get-CustomCommitMessage – basic VB popup box for custom commit message

Now I must note that currently this is only compatible with v4 and above though that can change – if I get enough time and requests to do so – though you could always add this in with your own updates to the module.

So let’s look at the Process to be used with the following functions.

Imagine we are creating a script called Get-UptimeInfo – we could easily create this and then save using the default handlers in ISE however there are some issues that I’ve found

  • File path defaults to the last saved location – Example being you are working on a script in C:\MyAwesomeScript then when you click Save it will save it there and for each time you reopen ISE it will default there – Not Ideal
  • I like things Centralised – that way I know where things are!

So to Overcome this we put at the beginning of the script the following #Script#Get-UptimeInfo# – this then tells the Save-CurrentISEFile or the Save-UnnamedFiles functions that we want to create a PS1 file called Get-UptimeInfo in the Scripts-WIP PSDrive location

This would look like the below before running either Function










And the We can run either function in the Command Pane like any other function










Oooh – look at that the file has saved and named Get-UptimeInfo – it is a ps1 file and we are being prompted about whether we want to add a Custom Commit Message – So we’ll click Yes and see what we get










Here we get a popup box, (currently uses VB for this but it works and is a few lines) asking us to provide our commit message – I’ll Add the Commit Message as “Testing PSISE_Addons Save-CurrentISEFile Function”

The Result can be seen below – note there is a Get-UptimeInfo.tests.ps1 file been created as well – This is set by the what you include in your profile as suggested in the PSISE_Addons.psm1 file













If we wanted to do the Same with Modules then it would be something like this #Module#FindSystemInfo# and that would tell Save-CurrentISEFile or the Save-UnnamedFiles functions that we want to create a folder in the Modules-WIP PSdrive location called FindSystemInfo and in there we want to save a PSM1 file called FindSystemInfo whilst also creating a compliant psd1 file for the Gallery & also Creating a FindSystemInfo.tests.ps1 file containing some default Pester tests











When we run the Save-CurrentISEFile function we get the Same as before











Again we will Click Yes here and in the next popup we will add the message “Adding New Module FindSystemInfo” and we can see this has happened below










But we can see here that there are 3 files added – a PSD1, a PSM1 and a tests.ps1 file have all been added to a New Folder based on the Module name FindSystemInfo – but we didn’t specify these. That’s because the Functions Save-CurrentISEFile & Save-AllUnnamedFiles will do the hard work for us and create a fully compliant with the PowerShell Gallery ps1d file and also a default Pester test as long as you have them specified in your profile. BONUS – I provide you sample versions of both of these with the module. How generous is that!

But the most important thing is being able to not have to call the actual functions but using simple keyboard combinations so as part of the ISE_Cew.psm1 file there is a sample part at the bottom to add into your PowerShell Profiles – again another easy freebie!

So you can now download this from the PowerShell Gallery using Install-Module ISE_Cew – so go and get it and give me some feed back via the GitHub Repo – https://github.com/kilasuit/ISE_Cew/

ThePSGallery AutoBot – Some Issues I’ve Found.

Ok so If you didn’t already know then this happened

And although it has been interesting it has also brought up some issues (mainly data which is one of my biggest bug bears in all things IT) with the PowerShell Gallery and these include and is not limited to

  • Publish-Module is partially Broken – This is due to it requiring you to add in LicenseURI & ProjectUri when run – however the issue then lies that this information doesn’t make it to the Gallery Pages nor does it make it to the Gallery Items when using Find-Module. This means that there is a seemingly large number of Modules that don’t seem to include this *mandatory* information.

    There is a workaround and this should be what you are doing anyway but that is to ensure that in the PSD1 file for the module that this information is included in there as then it gets populated to the Gallery correctly. It is thanks to an Impromptu chat with Doug Finke (@Dfinke) that this came out of the woodwork and was confirmed as being the resolution– So thanks Doug!

Also I decided to confirm this via uploading 2 different modules ThePSGallery-Working & ThePSGallery-Broken – conclusive results show that the only method to get the LicenseURI & ProjectURI to show in the Gallery (either via the Website or via Find-Module) is to include it in the psd1 file.


So Go and update your psd1 files to include this and please upvote this issue on UserVoice to either force this be updated or to drop the LicenseURI & ProjectURI from Publish-Module – http://windowsserver.uservoice.com/forums/301869-powershell/suggestions/11439807-gallery-issue-licenseuri-projecturi-aren-t-add

  • Author Details – Again this is massively broken due to the nature of the Gallery with simple things like spelling mistakes etc in Author names which then means there are 3 or 4 authors that are actually 1 person See the Author Details file in the Github Repo for the PSGallery ( https://github.com/kilasuit/ThePSGallery/ )for more details which was built using the below logic


Find-module * | Select-object Author | Sort-Object -Unique | Out-File Authors.txt

I would Suggest that the Gallery also allows the Profile to link to other Social networks like Twitter and get the Twitter Handle (Would be great to be able to get ThePSGallery Autobot to include the author in the tweets thus increasing visibility to those that submit work there)

I would also suggest that any Authors include an additional Hashtable for the PrivateData section that includes any additional Contact info – Like Twitter or Blog Urls etc and sets this as a default psd1 variable – Will be posting about this shortly.

  • Additional Metadata – I for one would like to be able to with the AutoBot to be able to tweet on 100, 1000, 10000 downloads of a module to congratulate the authors. However this isn’t made available at the present time via Find-Module however can be gotten via WebScraping Methods – Not particularly resource friendly and time consuming too. I have raised this to the Powers that be via UserVoice and you can upvote this as well via http://windowsserver.uservoice.com/forums/301869-powershell/suggestions/11279160-add-additonal-properties-to-powershell-gallery-ite
  • Lastly – Find-Module isn’t very User friendly for cmdlet, function, workflow or DSCResource searching if tags aren’t used.

    This is a bit simpler to get around but the logic is rather hidden in how to do so as you would have to call Find-Module * and then Pipe this to Select-Object -ExpandProperty Includes and then to Where-Object

    So for SharePoint it May look like this which isn’t very graceful at all but this does return the 2 Modules that have SharePoint in Function Names – Problem being what if they aren’t functions but Cmdlets.

    Find-Module * | Select-Object Name -ExpandProperty Includes | Where-Object {$_.Function -like ‘*SharePoint*’} | Select-Object Name

    Again there is a UserVoice Suggestion for this at http://windowsserver.uservoice.com/forums/301869-powershell/suggestions/11088855-find-module-needs-improvements-to-enable-better-di

Hopefully that’s a small insight to ThePSGallery AutoBot and in a future Blog Post I will detail the inner workings of the AutoBot including the actual script that runs it (not on Github as of yet)