Skip to main content

Posts

Showing posts with the label SAPIEN PowerShel Studio

Disabling the Copy Functionality in a Windows Form

I’m currently in the middle of writing version 2 of my Security+ learning engine.  Some of you from last weeks Security+ class know that I have been developing a tool using SAPIEN PowerShell Studio to help you with the massive amount of terminology that you need to know for the Sec+ exam.  You also remember that I was putting in some safe guards to help protect the application from piracy.  I’m going to share one of those safeguards.  Here is a current view of version 2 of the product. What I want to do is to disable the ability to copy the questions and answers to the clipboard.  Here is how you do it.  In the Designer view, click on the object that you want to protect.  In this case, I am clicking the text box that contains the questions.  In the Properties dialog, set the value for ShortcutsEnabled to False .  This turns off the right clicking capability of the object. While talking about Active Directory Rights Manage...

Test Generator made with SAPIEN PowerShell Studio

Many of you who read this blog know that I utilize SAPIEN PowerShell Studio when I need a GUI on top of my code.  Here is the latest.  As part of my delivery of Security+ for both the Navy and my civilian business, one item of concern that I hear time and time again is the sheer amount of terminology that students need to memorize.  On the Navy side, we only give them a week to take the course and prep for the exam, which is a huge undertaking.  To help address this issue, I used PowerShell Studio to create a testing engine. I have always told my PowerShell classes that if the tool does not exist, make it.  This tool continuously repeats questions until the student gets it right.  With several hundred test questions in the pool for the 11 modules that I teach, this test environment is part of the Azure lab environment that I have for each student.  There is another tool to help populate the test engine with questions.  without PowerShell Stu...

A New Trick with the Backtick

I know, I’m opening this can of worms again.  You either love or hate the backtick in PowerShell.  The little thing is so awesome, but so hard to see.  It is no secret that I use it for line continuation.  I have a set of rules that I follow to allow me to use it without issues.  Here they are.   At the end of the line: o    Press SPACE o    Press the BACKTICK o    Press ENTER o    Indent the first continued line o     Do not use it on the last line of the command Here is a command without line continuation: New-ADFineGrainedPasswordPolicy   -Name   "Group1PSO"   -Precedence   10   -ComplexityEnabled   $True   -Description   "PSO for Group 1"   -DisplayName "Group1PSO"   -LockoutDuration   "0.12:00:00"   -LockoutObservationWindow   "0.00:15:00"   -LockoutThreshold   3   -MaxPasswordAge   "10.00:00:00...

Recording a Data in a Log

I’m wrapping up another PowerShell class right now in Fort Wayne, IN.  At the end of my classes, I like to do a “Project Day”.  I invite my class to do a project for themselves in our test environment so I can coach them.  In between coaching, I’m working on prepping my content for the PowerShell Conference in Asia next week.  When I work on my projects, I keep the content on the big screen to get my class to ask questions. While working on the project in SAPIEN PowerShell Studio, I needed a way to format the date-time stamps on the internal log that I like to use when I’m coding a large project.  I noticed that what I was using was not sorting the way that I wanted it to based on the date-time information.  To fix this, I changed formats to YYYY-MM-DD HH:MM:SS.  I took a look at the GetDateTimeFormats method of the System.DateTime object to see if I could generate this format easily. PS C:\> (Get-Date).GetDateTimeFormats() 10/7...

How to use the OpenFileDialog Control with SAPIEN PowerShell Studio

Developing advanced GUIs is a neat way to expand your PowerShell coding capability.  Traditionally, we would have to learn a different programming language to do this.  That means you would have to learn PowerShell for your day-to-day tasks and something like C+ or .NET to crate the GUI.  After teaching PowerShell for the last 7 years, I know that IT Pros do not want to have to learn multiple languages.  With SAPIEN PowerShell Studio, you can leverage your PowerShell skill set in a visual environment. Today we are going to take a very simplistic view on how to graphically select files on your hard drive. First, create a simple form with these three controls.  Button, Label, OpenFileDialog.  The first two will appear on your form but the OpenFileDialog will appear below the form because it will open in a new window when called. Next, add the Click event to the button and then add this code: (Remember to add the event by right clicking button1 and ...

Acting on a Key press event of TAB with SAPIEN PowerShell Studio

Yesterday I wrote about how to capture a carriage return key press.  That is awesome and everything, but I also like to use TAB,  The problem is that the KeyPress event does not like the TAB key.  The KeyDown does if you also include the PreviewKeyDown event.  OK, let’s use the same setup as yesterday. Just a form and a text box. For the text box add the PreviewKeyDown and KeyDown events. In the PreviewKeyDown event, you only need to add one line of code.  In the KeyDown event, we do the same thing as yesterday.  This time we use the KeyValue property and the ASCII code of 9.  The rest is the same as yesterday. The green arrows show you the code that I added.  Just run it and press TAB .  The text box will turn blue.  Again, this is where you would place the action that you want to take place when TAB is pressed.  Have fun!

How to Act when ENTER is Pressed with SAPIEN PowerShell Studio

I’m deep into writing a new version of the stock monitor that I use to manage my investments.  I like things to work quickly so when I enter a stock symbol in a textbox and press ENTER, I want things to start happening.  Here is how you make things happen with the KeyPress  event.  Remember, I like to instruct with very simple examples.  First off, create a simple form and place a textbox in it.  I left the default name of textbox1 . Right click the textbox and select Add Events . Scroll down and select KeyPress . You need to do it this way so the event registers.  If you manual type the event to create it, it will not work. Now click Create . This is what you get. The first thing we are going to do is to suppress the “Ding” noise that you will get if you press ENTER.  We reference the event with $_.  Check out the members available to this event. We will set the Handled event to $true to pre...

Use SAPIEN PowerShell Studio to protect your Nintendo Stock Gains

Thanks to a lot of press, Pokémon Go raised Nintendo’s stock price by over 30% Today.  Unfortunately, you may not be able to set a stop loss on it to protect those gains because it is traded on a foreign stock market.  In this post, we will use SAPIEN PowerShell Studio 2016 to create a small GUI to alert us should the stock fall below a specified price. First off, create a New Form Project . Next you will need to create a form using 3 labels and 2 text boxes. Set the name of the first text box to Textbox_Symbol and the second to Textbox_Low   for the fourth label, set the name to Label_Price .  The names of the other form controls do not matter for this exercise. Pre-populate the value of Symbol with NTDOY .  Also pre-populate the value of Low with your selling price. Also add a Timer control and leave the default settings. In the script tab, replace the code with what is below. $MainForm_Load = {   $timer1 . Interval = 500...