I thought I would share a few simple functions that I find handy.  They are nowhere near rocket science but still worth it.  I think they would make a nice addition to your PowerShell profile so they are available each time you load PowerShell.

function Get-IP {ipconfig | where-object {$_ –like “*IPv4 Address*”}}
function cd\ {cd \}
function cd.. {cd ..}
function To-Binary{param($Num = $(Throw "We need a number to operate!"));[convert]::ToString($Num,2)}
function From-Binary{param([string]$Num = $(Throw “We need a number to operate!”));If ($Num.length -le 31) {[convert]::ToInt32($Num,2)} ElseIf ($Num.Length –le 63) {[convert]::ToInt64($Num,2)} Else {“Number too large for this function”}}

I will post again soon with a little detail about these.  They are not fully featured so there would be many ways to break these of course.  Take from them what you will.  One last warning, with any functions/alias/scripts, don't use them you are writing scripts or sharing PowerShell with others.  If you do use these, please ensure you include them with the code you are sharing.

 

This posting is provided "AS IS" with no warranties, and confers no rights. Use of included script samples are subject to the terms specified at http://www.microsoft.com/info/cpyright.htm.