For generating HTML I created a function that takes each object and generates a line of HTML code. Once I have an array of custom objects, I can easily use them in multiple scenarios. I did not want these to be included in my future "Fun With PowerShell Roundup" post. I needed to do a little filtering, as over the last year I’ve added a few more blog posts on other topics. After each object is created, it is added into an array. ![]() When I’ve found all three, I have a small function that creates a PowerShell custom object. I tackled this in stages.Īs the first stage, I simply loop over the data in the file, looking for the XML tags I need. That’s where PowerShell came to my rescue!įor each post, the exported XML file has three lines we are interested in, the tags with, and. They do provide the ability to limit the extract by by date range and subjects.Īs you can guess this extract file is large, far too much to sift through by hand. This includes all of the data including the post itself, comments, and associated metadata. You can generate an XML file with the entire contents of your blog. ![]() One of the administrator tools in the site is the ability to extract your blog. You can display the contents of any variable by highlighting it and using F8/F5. To run a snippet of code highlight the lines you want to execute, then in VSCode press F8 or in the IDE F5. My post Fun With PowerShell Pipelined Functions dedicates a section to the line continuation character if you want to learn more. The blog formatting has a limited width, so using the line continuation character makes the examples much easier to read. ![]() The examples should work in PowerShell 5.1 in the PowerShell IDE, although they’ve not been tested there.Īdditionally, be on the lookout for the backtick `, PowerShell’s line continuation character, at the end of many lines in the code samples. In this article I’ll be using PowerShell Core, 7.2.2, and VSCode. In my next post I’ll show the same methodology for generating Markdown, and in the next post will do the PowerShell roundup.įor all of the examples we’ll display the code, then (when applicable) under it the result of our code. In this post I’ll cover the code I created to extract all my links, and how I generated HTML from it. My blog is hosted on, which provides an export function. In addition, I’ll be able to reuse the code when I’m ready to wrap up my next, or a future, series. In a few posts I’m going to start a new series on a different subject, but first I wanted to provide a wrap up post with links to all my recent PowerShell posts.Įxtracting all of those titles and links by hand seemed like a labor intensive task, so of course I wanted to automate it. Since September of 2020 I have been blogging heavily on PowerShell.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |