Good afternoon!
Recently I have written two scripts in order to make life easier. I would love to get some feedback on any/all things I can do to improve or tweak my code and continue improving.
First every morning I have to open some webpages, RDP, and a specific file so I wrote this script:
# Below opens the three webpages I need on the same Edge window Start-Process Microsoft-Edge:https://www.website1.com/ Start-Process Microsoft-Edge:https://www.website2.com/ Start-Process Microsoft-Edge:http://www.website3.com/ # Below opens the RDP GUI Start-Process -FilePath "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Accessories\Remote Desktop Connection" # Below opens the word document I need Start-Process -FilePath "\\ShareDriveExample\Example\Example\Document.docx"
Secondly I was tasked with pulling the installed software information off of some of our servers. To make it easy I wrote this:
Invoke-Command -ComputerName "examplePC" -ScriptBlock {Get-ItemProperty HKLM:\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\* | Select-Object DisplayName, DisplayVersion | Format-Table –AutoSize} > C:\Users\UserExample\Desktop\Example.txt
The “problems” I am having currently are two websites do not have trusted certificates so I have to click Advanced-Proceed. I would like it to automatically do that for me but can’t figure out how. I am running PowerShell 5.1 so I don’t have access to a couple commands on 6.0
Also, the information pulled from the servers has a bunch of space between blocks of data. So I have to delete the whitespace to condense it for easy reading. Any tips on that?
I am still getting used to PowerShell so any constructive criticism is greatly appreciated!