PowerShell Objects

Sometimes (Ps)Objects got to many properties for the human eye that it is hard to filter what information is useful for the situation and what not.
For example take the Get-Mailbox Cmdlet from the exchange management tools
It returns 214 properties for each mailbox! So you have to manually make a selection of what properties you would like to see or work with.

Normally i would use Get-Member and pipe it to Out-Gridview -PassThru after doing that to many times i created this little snippet you could use in your profile of a custom module

i created this little function to help with selecting the right ones. the function is a quick and dirty one but it works for me.

I found this little Gist from user: altrive
The snippet is to create Windows Toast notifications in PowerShell

Wow that’s nice

This seems to be an excellent way to display progress of a script that is running in the background.
Or maybe a planned task that will triggers on a certain event in the event-log

So I started to fiddle around with the code and created this little function that I like to Share:

Here are some examples:

PS> Show-WinToast -Title "Windows PowerShell" #Sample 1
PS> Show-WinToast -Title "Windows PowerShell" -Message "Lorem ipsum dolor sit amet." #Sample 2
PS> Show-WinToast -Title "Windows PowerShell" -Image "$PSScriptRoot\ps.png" #Sample 3
PS> Show-WinToast -Title "Windows PowerShell" -Image "$PSScriptRoot\ps.png" -Message "Lorem ipsum dolor sit amet." #Sample 4

It results in some different types of Toasts displayed in the following image:

The function is a work in progress but it will function!

You can find the code on GitHub Or download it from PowerShell Gallery


PS> Save-Module -Name Proxx.Toast -Path <path>


PS> Install-Module -Name Proxx.Toast

When I started to learn PowerShell I needed a Scripting environment.
At the time (Ps Version 2.0) the ISE was not what I expected.
then i found the Quest PowerGui Software and that seemed to fit my expectations, Since dell has taken over the software from Quest all support has been dropped and the latest version is from 2013.
And since Dell does not release the source I consider that the software will die slowly an painful. Once I moved back to the PowerShell ISE I missed one function Run in Shell specifically.

Sometimes you want to run a script in a fresh PowerShell Console instead of a dirty polluted ISE I know you can create a new PowerShell Tab which is fresh but to me that’s is a bit of a messy solution.

So I figured I could create a function and PowerShell ISE Add-on Menu and I like to share this with you all.

if someone could tell me how i can add a button to ISE please let me know!

Back in the day, when connecting to Unix/Linux terminal or connecting to IRC. there was I almost always a MOTD Message. originally the message was used to send a common message to all users, in a more efficient manner than sending them all an e-mail message. but the most messages that I noticed where quotes from VIP’s, Movies, etc.

that gave me an idea..

why not have a Norris quote when opening PowerShell?

Add this to your $profile location

(ConvertFrom-Json (Invoke-WebRequest "http://api.icndb.com/jokes/random").content | Select-Object -ExpandProperty Value | Select-Object -ExpandProperty joke).Replace("&quot;","")

The missing Cmdlet!

When working with modules there are a lot of Cmdlets Microsoft has published for us.

PS U:\> get-command *ModuleManifest*,*-Module -Module Microsoft.PowerShell.Core

CommandType     Name                                               Version    Source                                                                                                                                                                                                              
-----------     ----                                               -------    ------                                                                                                                                                                                                              
Cmdlet          Get-Module                                   Microsoft.PowerShell.Core                                                                                                                                                                                           
Cmdlet          Import-Module                                Microsoft.PowerShell.Core                                                                                                                                                                                           
Cmdlet          New-Module                                   Microsoft.PowerShell.Core                                                                                                                                                                                           
Cmdlet          New-ModuleManifest                           Microsoft.PowerShell.Core                                                                                                                                                                                           
Cmdlet          Remove-Module                                Microsoft.PowerShell.Core                                                                                                                                                                                           
Cmdlet          Test-ModuleManifest                          Microsoft.PowerShell.Core

With the new version of PowerShell (version 5) we even have an official PowerShell Module Repository and that comes with even more functions bundled with the PowerShellGet module

PS U:\> get-command * -Module PowerShellGet -CommandType Function

CommandType     Name                                               Version    Source                                                                                                                                                                                                              
-----------     ----                                               -------    ------                                                                                                                                                                                                              
Function        Find-Module                                        1.0        PowerShellGet                                                                                                                                                                                                       
Function        Get-InstalledModule                                1.0        PowerShellGet                                                                                                                                                                                                       
Function        Get-PSRepository                                   1.0        PowerShellGet                                                                                                                                                                                                       
Function        Install-Module                                     1.0        PowerShellGet                                                                                                                                                                                                       
Function        Publish-Module                                     1.0        PowerShellGet                                                                                                                                                                                                       
Function        Register-PSRepository                              1.0        PowerShellGet                                                                                                                                                                                                       
Function        Save-Module                                        1.0        PowerShellGet                                                                                                                                                                                                       
Function        Set-PSRepository                                   1.0        PowerShellGet                                                                                                                                                                                                       
Function        Uninstall-Module                                   1.0        PowerShellGet                                                                                                                                                                                                       
Function        Unregister-PSRepository                            1.0        PowerShellGet                                                                                                                                                                                                       
Function        Update-Module                                      1.0        PowerShellGet 

As you can see we have Functions/Cmdlets for almost everything you can imagine.

But not to Edit, Change or Update the manifest file!

you could do this manually like i did before.
but we use PowerShell to automate things and make life easier.
And on the other end we are editing Manifest files by hand.. thats a bit strange isn’t it?

So here is my Update-ModuleManifest function.
Feel free to copy, share, or update but please mention me in the .NOTES block