I got started with PowerShell thanks to the encouragement and enthusiasm of a friend and former colleague. Following that, I've largely developed my knowledge through the standard combinations of trial + error + googling and more recently (as is evident) by doing my best to engage with and give back to the
Another update to my new book, PowerShell 101: The No-Nonsense Beginner’s Guide to PowerShell is now available. The update which was published this morning added chapter 3 to the already available first two chapters. If you’re interested in purchasing this book, consider buying it while it’s still a work in progress. The price of the book increases slightly with each chapter that’s released.
This is a two part series about the PowerShell NameIT module, published on the PowerShell Gallery. Chris Hunt, co-contributor, has a companion post on his blog AutomatedOps.
I came across a GitHub repo where Mitch Denny created a tool that is a simple tool to generate names and check them for availability. He wrote it in TypeScript and I was interested because of the template language he built to interact with the tool.
It seems to me that the topic of finding or detecting module updates on the PowerShell Gallery has gotten a lot of interest over the last few days. So I thought I’d contribute my bit of code to check currently installed modules against their online versions in the PowerShell Gallery. I have a PowerShell script … Continue reading "Check for Module Updates"
The new PowerShell cmdlets that are part of the SQLServer PowerShell module that’s distributed as part of SSMS (SQL Server Management Studio) 2016 make it super easy to write the output of PowerShell commands to a SQL Server database. The ActiveDirectory PowerShell module that’s part of the RSAT (Remote Server Administration Tools) is also required by the code shown in this blog article.
PowerShell Version: >4 Modules: Posh-SSH So, this is a pretty specific one! I have been tasked to backup old and new ProCurve Switches and of course I am using PowerShell for this 😉 I found a script about doing this via SFTP where you enable ip ssh filetransfer on the switches and get the files from there […]
The post Backup HP ProCurve Switches via SSH, TFTP and PowerShell appeared first on blog.
When unit testing with Pester, mocking is pretty much unavoidable, especially for code related to infrastructure, configuration, or deployment. We don’t want our unit tests to touch files, a database, the registry, and not to mention the internet, do we ? With Pester’s Mock function, we can isolate our code from this outside (hostile ?) … Continue reading Unit Testing with Pester
Currently I am working on a big new module. In this module, I need to persist data to disk and reprocess them at some point even if the module/powershell session was closed. I needed to serialize objects and save them to disk. It needed to be very efficient to be able to support a high volume of objects. Hence I decided to turn this serializer into a module called HashData.Other Serializing methodsIn Powershell we have several possibilities to serialize objects.
Earlier this month I had the pleasure of presenting at the Nordic Infrastructure Conference (NIC). This is still a relatively young conference as these things go, but you couldn’t tell based on my experiences. Given the demise of TechEd Europe, conferences like this are filling the void, and doing a fantastic job. The conference draws … Continue reading "NIC 2017 Slides and Demos"
Recently, I decided to try to determine if there was a way to manage Altaro VM Backup with PowerShell. I figured there must be some database, files, or something that I could at least query with PowerShell. What I found is Altaro has a RESTful API and they have numerous PowerShell scripts for working with it. In Altaro version 7, there are 33 PowerShell scripts located in the “C:\Program Files\Altaro\Altaro Backup\Cmdlets” folder if you took the defaults during the installation, otherwise they’re wherever you installed Altaro.
Yesterday, Microsoft’s Ed Wilson announced the Honorary Scripting Guys for 2016. I am honored and very proud to be the newest Honorary Scripting Guy, joining this year’s repeat winners: Sean Kearney, Teresa Wilson, and Will Anderson.Read More...
Lucene.NET is . . .
a full-text search engine
written in C#
PowerShell and Lucene
In 2016, Bruce Payette (co-founder of PowerShell), presented at the PowerShell conference in Germany on Lucene.NET full text search
engine with PowerShell.
Working from his example, in PowerShell I layered a WPF UI on top of the search engine. You can specify directories and patterns to do a full text index on like c:\posh\*.
Last week, I announced a new book for PowerShell beginners that I’m self-publishing. I decided to create a short video about the book and cover the topics from Chapter 1. The video can also be found on YouTube.com The book (PowerShell 101: The No-Nonsense Beginner’s Guide to PowerShell) can be found on Leanpub.com. µ
PowerShell Version: >1 Modules: none As I am focused on a new check_mk implementation there might be a lot of PowerShell/check_mk around here for a bit 😉 This time I wrote something to monitor the result of a scheduled task the oldschool way. With PowerShell >4 you can use the Get-ScheduledTask function as shown here but as I […]
The post Monitor scheduled Tasks using PowerShell and check_mk appeared first on blog.
Recently I posted a PowerShell tool for creating a GitHub repository. In continuing my exploration of the GitHub API I wrote another PowerShell tool to create a GitHub gist. A gist is simple way to store and share snippets or code samples. I use them to share simple PowerShell scripts or other works that aren’t … Continue reading "Creating a Github Gist with PowerShell"
I’ve contributed, co-authored, performed technical reviews and edits on a number of PowerShell books. I also speak to a lot of beginners at user group meetings and technology events such as PowerShell Saturday’s and SQL Saturday’s. One thing I’ve found is there are still a lot of IT Pro’s out there who are reluctant to learn PowerShell and they’re often overwhelmed by information overload when they do try to learn it.
PowerShell Version: >4 Modules: none I just wrote a custom local check for check_mk to get the Citrix Licensing Usage checked. All you need to do is fill in the $license_server and maybe customize $percent_warning and $percent_critical. The check reads the licensing WMI and gives you OK / WARNING / CRIT in check_mk for the corresponding […]
The post Using PowerShell and check_mk to monitor Citrix Licensing Usage appeared first on blog.
Sometimes I do things in PowerShell just to see what happens. This is a great way to learn about new cmdlets and techniques. Sometimes these experiments lead to useful results. Other times they may end up as teaching devices. Of course the result could serve both purposes and you may have to decide that today … Continue reading "Storing PowerShell Credentials in JSON"
While experimenting with AppVeyor to add Continuous Integration to my PowerShell projects (more detailed blog post to follow) I encountered a bug that meant that the Pester test results (uploaded via the NUnit formatted results file) were not appearing in the "Tests" tab of my AppVeyor project.
-- Update: The
While developing a PowerShell function to query the API of the webcomic XKCD I decided to explore and implement Parameter Sets. These allow you to provide your users with different sets of parameters based on different use cases (assuming you have multiple use cases), which as a result provides a
Overview Pester and PSScriptAnalyzer are both fundamental tools for testing the effectiveness and correctness of PowerShell scripts, modules, and other PowerShell artifacts. While it is relatively convenient and straightforward to run these tools on a localRead More...
I needed a project for my Xmas holiday and I needed something remotely work related. Thus the dubious PoshARM Powershell module was born and brought to life during my Xmas holiday. Simply put it is a module that lets you build – for now – simple Azure Resource Manager (ARM) templates with Powershell. The module can also import templates from a file or from the clipboard/string. Your partial template or ready made template can be exported as a Powershell script.
I’ve been continuing to work with the GitHub API in PowerShell. Today I have a function you can use to create a new GitHub repository. Of course you will need to have a GitHub account and another piece of critical information, but after that it is quite easy to create new repositories. This makes it … Continue reading "Creating a GitHub Repository from PowerShell"
This post is part of the series on AutoCompletion options for PowerShell! Click the banner for more posts in the series! Probably my single favorite feature of PowerShell isn’t exciting to most people…but I love Auto-Completion. I have my… Continue reading →
I recently presented a session for the Mississippi PowerShell User Group on PowerShell Non-Monolithic Script Module Design. While preparing for that session, I discovered that a problem I had previously experienced with Update-ModuleManifest when trying to update the FunctionsToExport section when FormatsToProcess is specified appeared to be resolved in PowerShell version 5.1 (I’m running build 14393).
DSC is truly one of my favorite things to come out of the PowerShell team to date. The power for idempotent infrastructure and deployment is great. However, one relatively minor roadblock is getting an MOF delivery pipeline in place for getting the MOF configurations to a pull server.
As you probably already know, when writing a DSC configuration, separating the environmental data from the configuration logic is a best practice. So all the environment-specific data gets stored in separate (typically .psd1) files. If you work with PowerShell DSC at medium-to-large scale, you (hopefully) have separate configuration data files for each customer and each … Continue reading Me
How often do you check to make sure that things like antivirus has received the latest definition files on all of your servers? There’s probably some centralized GUI interface somewhere that you could log into and check. The antivirus product itself may even have some sort of notification system that sends alerts if the updates fail. Both of those options provide data in a format that can’t be worked with and what happens if something falls through the cracks? Are you willing to bet your job and possible the reputation of your company that some junior level engineer is monitoring those systems? While each antivirus product is different, it’s fairly simple to determine if the information for the antivirus product is stored somewhere such as in the registry where you can access it remotely with PowerShell.
As you should be aware, the next version of PowerShell is open source and cross-platform. You will be able to run PowerShell v6 on Windows, a Mac and select Linux distributions. All of the code is currently in alpha and hosted on the PowerShell GitHub repository. This is also where you can download new builds … Continue reading "PowerShell 6.0 Release Tools"
Can you tell in PowerShell if a string ends in a specific character, or if it starts in one? Of course you can. Regex to the rescue! It’s a pretty simple task, actually. Consider the followingRead More...
I run a self-hosted WordPress blog here as part of a hosted package. I run this on a very tight budget so I’m pretty sure I share resources with other tenants. This means that sometimes the server is unavailable, usually for only a brief period of time. I have the JetPack WordPress plugin configured to … Continue reading "Web Testing with PowerShell"
Yesterday I showed you a class-based PowerShell script. My intention was to have a little bit of fun and teach you the basics of using a class. But what I gave you was really just the first step. If you wanted to create an actual tool around a class, you will most likely want to … Continue reading "A Classy Christmas PowerShell Module"
Well it’s that time of year again to have some holiday fun with PowerShell. This year I thought I’d give you a classy present. Or more accurately, a class-based PowerShell toy. Classes were introduced in PowerShell 5.0, primarily with DSC resources in mind, but you can use classes for all sorts of things. In simple … Continue reading "A Classy PowerShell Christmas"
An alternate title might be ‘Running PowerShell Code ONLY when the power state changes’, because that was the very interesting task I received from my customer this week. It was honestly too cool of a StackOverflow answer NOT to share,… Continue reading →
Many PowerShell commands return output in the form of objects (some return nothing at all). An example of this is shown in the following example where properties and their corresponding values are returned. CommandType is a property and Cmdlet is the value for that particular property for each of the results: Keep in mind that what is shown in the default output may not be the actual property names (compare the default output from Get-Process to the properties listed from Get-Process | Get-Member for an example of this).
One of the huge benefits of attending in-person technology events is getting to network with others. While at the MVP Summit last month I had a chance to demonstrate some of my PowerShell code and Pester tests to Jim Truher. I was developing the code and tests for a session to present for the PowerShell Virtual Chapter of SQL PASS (the code and a video of that presentation can be found here). In one of my examples, I was looping through a collection of items (computer names of SQL Servers) to run Pester tests against each one using a foreach loop similar to what you’ll find in this blog article.
Building custom images on AWS
For a very long time people have built custom images for cloud consumption with the help of Packer. Packer is an open source tool that works across multiple platforms like Amazon Web Services (AWS) and Microsoft Azure.
For just as long users on AWS relied for some customisation of those Elastic Cloud Compute (EC2) instances on a service being present called the EC2Config service.
PowerShell Version: >4 Modules: VMware vSphere PowerCLI While having issues with HP Data Protector and VMware backups I created a script that logs in to different vCenter Servers and checks for Data Protector Snapshots that are older than x and removes them. This script can easily be customized to suite your environment and needs. [crayon-58b0e6413456f623650388/]
The post Removing vCenter Snapshots with PowerShell and VMware vSphere PowerCLI appeared first on blog.
PowerShell Version: 4 Modules: GroupPolicy If you find yourself lost in the jungle of existing GPOs in your environment use some PowerShell to sort out the ones that might not be needed anymore. [crayon-58b0e641346cb565281826/]
The post Look for unused GPOs with PowerShell appeared first on blog.feldmann.io.
For the PowerShell 10 Year Anniversary, Will Anderson (@GamerLivingWill on Twitter) and I (@MrThomasRayner on Twitter) ran a three-hole code golf competition on code-golf.com, a site developed by fellow MVP Adam Driscoll. Here is the linkRead More...
Not all PowerShell Modules are published to the PowerShellGallery, many are hosted on GitHub. Plus, many of the modules published to the gallery are also hosted on GitHub and in repo branches. PowerShell open source authors (like myself) have newer versions in source control that have not been promoted to the PowerShell gallery because they are not complete or fully tested.
There needs to be an easy way to get the latest updates from the repo.
By default, Copy-Item will overwrite a file if it exists, unless that file is marked Read Only (in which case you can use the -Force switch to overwrite the file). What if you want to only copyRead More...
BYO PowerShell modules to Azure Functions
The previous articles introduced you to Azure Functions and how it executes PowerShell code. This article will explain how Azure Functions can be extended by bringing your own PowerShell modules.
As we have seen in this introductory article there are already a few PowerShell modules present in the Azure Functions runtime environment but especially when we have to be a bit more special then we quickly end up in a situation where we need access to custom modules.
PowerShell is getting increasing attention and gaining followers each day. That is a good thing in my book. I saw a tweet about Citrix OctoBlu automation where Dave Brett (@dbretty) was using it to save money with a PowerShell script (full post here) to power on and off VMs. I reached out to him and asked if he would like a little help with his PowerShell script. To my delight, he happily accepted and this post is about how I transformed his scripts to take advantage of the full power of The Shell.