Skip to main content

Posts

Showing posts from August, 2013

Getting information back from a Message Box with PowerShell

Sometimes I want a script to run automatically, but still prompt me before it takes an action.  A neat way of doing this is with a pop up message box.  Utilizing the MessageBox class from the .NET Framework, we can do just that.  For example, maybe I have a script that notifies me with the Dow Jones Industrial Average drops by 300 points in the current trading session.  Hey, that is a money making opportunity!  1 2 3 4 5 6 [ System.Reflection.Assembly ]:: LoadWithPartialName( "System.Windows.Forms" ) $Answer = [ Windows.Forms.MessageBox ]:: Show( "DJIA has dropped by 300 points today `n Do you want to `n go to your IRA?" , "Trade Alert" ,           [ Windows.Forms.MessageBoxButtons ]:: YESNO ,           [ Windows.Forms.MessageBoxIcon ]:: Information) If ( $Answer -eq "Yes" ) {     Write-Host "Do Something." } Essentially, line 1 gives us access to the Windows Forms objects. Line

How to configure Group Policy to allow you to offer Remote Assistance

Let’s face it, no matter how hard you try, it is sometimes best if you just do it yourself. In the tech support world, we have to often remind ourselves that the talents of our users is not in IT and we need to do more than just talk someone through a problem. Remote Assistance in Windows allows you to both see and interact with the end users’ desktop while they are still logged in. The standard set up of Remote Assistance is for the user to request assistance. This can be an issue for many users as it adds to the stress of the situation. Configuring your environment to allow you help desk to offer remote assistance will increase the speed of the support while at the same time decreasing the stress of the problem. To turn on the ability to offer remote assistance, configure this GPO: Computer Configuration / Policies / Administrative Templates / System / Remote Assistance / Configure Offer Remote Assistance Set this policy to Enabled. Scope this GPO to apply to your domain. You may a

Have PowerShell Verbally Provide Information

Let’s face it.  Sometimes scripts take a while to run.   Often I have a lower end client sitting in the back of my office specifically for executing schedule scripts or scripts that will run for a long period of time.  Normally I have the scripts email me once they have completed and I simply run Receive-job to collect the data. I developed this cmdlet as a fun way of demonstrating passing input via the pipeline into a cmdlet.  It gives you the opportunity to have PowerShell talk to you.  Maybe to alert you that a threshold has been exceeded or to let you know that a workflow has completed.  In any case, have some fun with.  Remember its intent was to act as a demonstration of parameter passing.  Look carefully and you will see examples of passing parameters ByValue and ByPropertyName. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41