This function will let you create a database connection object for connecting to a MySQL database. It supports the usual parameters; DatabaseServer, DatabaseName, Port and Credential and will return a MySqlConnection object. (more…)
Tag: Custom Function
Show-Calendar, cal for PowerShell
This is a PowerShell implementation of the cal command found in Unix/Linux. Its task is quite simply to output a calendar view of the choosen month(s). (more…)
Get-FileType
The other day I came across an excellent function written by Boe Prox, called Get-FileSignature. His function will read a file and give you the Hex and ASCII signature of the file. I thought a bit about how I could use this function and came across several sites on-line listing the file signatures of known file formats. That got me thinking! What if I could create a function that tried to determine a files type based on its file signature? (more…)
Get in the Christmas spirit with PowerShell
Get-HPHardwareInfo
If you work in an environment with HP servers, this function will help you get hardware information from the HP Insight Management WBEM providers if you have them installed. It uses CIM to query several HP specific classes in the root\hpq namespace. The following information will be returned by the function: (more…)
Get-PhysicalMemory
This is another old WMI function I have rewritten to use CIM instead. This one queries computers for memory information. (more…)
Get-Cpu
Some days ago I wrote about taking the leap and start using CIM instead of the good, old Get-WmiObject. I wrote the CIM function template as a result of some WMI functions that I decided to rewrite. Today I give you the first of them; Get-Cpu. (more…)
Search-Spotify
Have you ever wanted to search Spotify from the PowerShell console? No? Want to try it anyway? I’ll show you how…
(more…)
Runspaces made simple
PowerShell is great at simplifying and automating your daily tasks. And it’s only natural that after you have automated or scripted most of your simple tasks, you start creating bigger scripts. If you work in a large environment, running for instance a script that uses WMI to query computers for data can take a long time to complete. The solution? Multi-threading of course. One way of doing this is using the built-in ‘Jobs’ cmdlets, but what this post is about is Runspaces.
Logging made simple
Logging is perhaps not the first thing you think about when making small scripts that is only intended to be used by yourself, but the moment other people are involved, the probability of something going wrong is going up. And making scripts intended for others usually means the size and complexity goes up as well. At some point, you will get tired of feedback from others that are hard to debug, and wish you wrote logging into your script! What if logging was as simple as just adding a bunch of “Write-Log”‘s in your code? I’ll show you how.
(more…)