Another Look at PowerShell Core Version Information

As PowerShell Core begins to spread into our world, and as we start thinking about working and scripting cross-platform, it will be useful to know what type of platform you are running on. The built in $PSVersionTable is an obvious place to start. On PowerShell Core there are also some new built-in variables you can use.

image

But these variables are not on Windows PowerShell. So I decided to add another tool to the mix – a simple function that will provide a snapshot look at version information, including what possible remoting options are available. This should be WinRM for Windows platforms and potentially SSH. The function isn’t especially complicated.

Here’s what it looks like on a variety of platforms.

image

 

image

image

I might package this into my PSScriptTools module.

Have you started embracing this cross-platform world? What challenges have you encountered and how have your overcome them? I’d love to hear your stories.

Email Reminders for PowerShell Tasks

I’ve published a new version of the myTasks module to the PowerShell Gallery and its GitHub repository. The big change is that the current version has a feature to send you a daily email with tasks that are due in the next three days. I’ve added a command called Enable-EmailReminder that will create a scheduled PowerShell job to send you an email using the Send-MailMessage cmdlet. The default is to send an email daily at 8:00AM but you can change the time. The default is to also send a plain text message but you have an option to send an HTML email which will include some color coding.

image

There are also commands to remove the scheduled job, as well as get the job information. There’s no provision for modifying an existing email reminder job. I figured if you make a mistake it is just as easy to disable (remove) the old run and re-create it. This is also documented in the help about topic.

image

According to the PowerShell Gallery at least a few of you have downloaded the module. I use it every day to keep track of what I should be working on. If you have any comments, issues or suggestions, I welcome them in the Issues section of the project’s Github repo.

A PowerShell DNS Suffix Tool

The other day my good friend Greg Shields asked for a little assistance with a PowerShell problem. He was trying to use PowerShell to set the primary DNS suffix for a computer. This  is different than the DNS suffix you can set on a network adapter configuration. Instead, he was looking at the dialog box you get when you set the computer name under advanced properties from the control panel System settings.

system1

We couldn’t find any cmdlet that would modify this setting. Eventually Greg discovered that you need to set both the Domain and NV Domain settings under

HKLM:\system\CurrentControlSet\Services\tcpip\parameters. Now that, was something I could work with.

Within short order I had a simple module, DNSSuffix, with commands to get the domain settings and set them.  The functions use PowerShell remoting so that you can manage remote computers. You can check out the documentation and code in Github (https://github.com/jdhitsolutions/DNSSuffix) or install the module from the PowerShell Gallery: Install-Module DNSSuffix.

 

If you run into issues or have suggestions, please use the Issues section of the GitHub repository.

Extending PowerShell DateTime Objects

I’ve been experimenting more with my PSTypeExtensionTools module, finding more objects to enhance.  You can check out the project on Github and install the module from the PowerShell Gallery. My current fun has been with the DateTime object – specifically converting a value into another culture.  Apparently those of us in North America don’t know how to format a date properly. But now with a few script methods added to the DateTime type, I can correct that oversight.

Continue reading

New PowerShell Projects Published

Last week I published a few of the recent PowerShell modules I’ve been working on to the PowerShell Gallery. These projects had been in a beta phase while I worked out some last minute features. I was also waiting to see if there were any issues reported by you that I might need to address. Nothing came up so I think we’re good to go. Here’s the new projects you can install from the PowerShell Gallery.

Continue reading