header image

Archive for June, 2019

PowerShell Space Invaders

Posted by: | June 30, 2019 Comments Off on PowerShell Space Invaders |

Way back in 2007 (PowerShell v1 days) I wrote about PowerShell space Invaders.  I’ve just tried it in PowerShell v7 preview 1 and it seemed to work just fine including sound.   It runs in PowerShell v6.2.1 but without sound – there some error messages that probably relate to the missing sound but they go so […]

under: PowerShell

Load format file in a module

Posted by: | June 30, 2019 Comments Off on Load format file in a module |

Staying with the test-connection function I thought I’d show how to turn the function and format file into a module. This includes how to load the format file in a module.   Create a folder TestConnection   Copy the format file and the script file that contains the test-connection function into the folder.   Rename […]

under: PowerShell 7, PowerShell v6

Test-Connection formatting

Posted by: | June 30, 2019 Comments Off on Test-Connection formatting |

Last time I showed how to write a function that replaces the current PowerShell 6/7 Test-Connection. This time I’ll show you how to do the Test-Connection formatting. Using just the function you get something like this: PS> test-connection -computername Success : True Source : W10PROIP Destination : IPV4Address : Bytes : 32 […]

under: PowerShell 7, PowerShell v6

PowerShell 6/7 Test-Connection

Posted by: | June 27, 2019 Comments Off on PowerShell 6/7 Test-Connection |

The PowerShell 6/7 Test-Connection implementation as of PowerShell v6.2.1 and PowerShell v7.0 preview 1 is in my opinion a horrible example of how not to create output. the cmdlet shows each ping and then wraps all of the results in the Replies property so you need to do something like this: Test-Connection | select […]

under: PowerShell 7, PowerShell v6

Quotes in CSVs

Posted by: | June 26, 2019 Comments Off on Quotes in CSVs |

Up to and including PowerShell v6.2.x converting or exporting data to a csv has automatically put quotes round each field. In PowerShell v7 you can control quotes in CSVs Using Get-Service | ConvertTo-Csv as an example.   The current behaviour is to put quotes round everything “XboxNetApiSvc”,”System.ServiceProcess.ServiceController[]”,”False”,”False”,”False”,”Xbox Live Networking Service”,”Syst em.ServiceProcess.ServiceController[]”,”.”,”XboxNetApiSvc”,”System.ServiceProcess.ServiceController[]”,,”Stopped”,”Win32 ShareProcess”,”Manual”,,   This is […]

under: PowerShell 7

CDXML schema checks

Posted by: | June 25, 2019 Comments Off on CDXML schema checks |

PowerShell v3 introduced CDXML modules. Cmdlet Definition XML wraps a CIM class in XML to create a module. The methods of the CIM class can be used to generate additional cmdlets for the module. Many of the modules introduced with Windows 8 – including the networking and storage modules – are created in this manner […]

under: PowerShell 7

PowerShell Line continuation

Posted by: | June 24, 2019 Comments Off on PowerShell Line continuation |

There are a number of ways to signal PowerShell line continuation in your code. probably the most common is to have a pipeline symbol at the end of the line: Get-Process | Sort-Object -Property CPU -Descending -Top 5   because there’s nothing after the pipe symbol PowerShell assumes that the next line of code is […]

under: PowerShell 7

Test DNS servers

Posted by: | June 22, 2019 Comments Off on Test DNS servers |

Had a recent comment about testing DNS servers which got me thinking how do I test DNS servers. I decided I wanted to get the DNS server address from the client, ping the DNS server to test network connectivity and test if DNS was up and working. The current result is this: function test-dnsserver { […]

under: DNS

Windows Terminal

Posted by: | June 22, 2019 Comments Off on Windows Terminal |

Microsoft have released the first preview of the new Windows Terminal to the Windows store – https://devblogs.microsoft.com/commandline/windows-terminal-microsoft-store-preview-release/   Its currently only available for Windows 10 v18362 or later.   The terminal is a replacement for the very elderly Windows console – used for command prompt and PowerShell.   Some improvements over the old console include multiple […]

under: Windows 10

PowerShell 7 roadmap

Posted by: | June 21, 2019 Comments Off on PowerShell 7 roadmap |

It was recently announced that the next version of PowerShell core will be 7.0 not 6.3. The PowerShell 7 roadmap is available at https://devblogs.microsoft.com/powershell/powershell-7-road-map/   The highlights are PowerShell 7 eventually replacing Windows PowerShell but I expect that’ll be 7.x rather than 7.0 as the mechanisms to update PowerShell aren’t in place. The Windows PowerShell […]

under: PowerShell 7

Older Posts »