Showing posts with label WinForm. Show all posts
Showing posts with label WinForm. Show all posts

2015/02/15

Introducing WinFormPS: PowerShell module to interact with WinForms controls


I started to work on a PowerShell module called WinFormPS.
This module contains a few functions that let you interact with Windows Form controls such as DataGridView, ListBox or Button controls for example.

To build those forms I mostly use PowerShell Studio from Sapien but this can also work with any simple Form created from scratch.

The motivation to create User Interfaces has always been to ease the work of  departments and teams with some of their heavy tasks, or simply to speed up some very repetitive processes. I definitely don't have a developer background, so please bear with me and feel free to critique or push update to the module on GitHub :-)


WinForms
Windows Forms (WinForms) is the name given to a graphical (GUI) class library included as a part of Microsoft .NET Framework, providing a platform to write rich client applications for desktop, laptop, and tablet. While it is seen as a replacement for the earlier and more complex C++ based Microsoft Foundation Class Library, it does not offer a comparable paradigm and only act as a platform for the user interface tier in a multi-tier solution. -Wikipedia

2015/01/10

PowerShell Studio 2014 - DataGridView Sorting

When creating graphical tools with PowerShell Studio 2014 and using the DataGridView control, I often find myself looking for the following tip!

The DataGridView control provides a customizable table for displaying data. You can extend the DataGridView control in a number of ways to build custom behaviors into your applications. A DataView provides a means to filter and sort data within a DataTable. The following example shows how to sort a DataGridView by using a DataTable Object.

In this example, I'm using PowerShell Studio 2014 from SAPIEN, you can download a 45 days trial version here.


2014/10/04

PowerShell GUI - LazyTS (Terminal Services Management)


LazyTS is a PowerShell script to manage Sessions and Processes on local or remote machines. It allows you to Query/Disconnect/Stop session(s), Query/Stop process(es) and Send Interactive message to one or more sessions.

This tool is using the module PSTerminalService which relies on the Cassia .NET Library.I used Sapien PowerShell Studio 2014 to which make life easier if you want to start building WinForms tools and add PowerShell code.

2013/10/11

PowerShell Studio 2012 - WinForms - GUI ToolMaking

In my previous post I showed how to create a quick PowerShell GUI to append some colored text in a RichTextBox control using Sapien PowerShell Studio 2012.

Today I will go a bit further and show you how to create a tool to query some information from a remote computer. I will first send the Output to Out-GridView cmdlet and then show you how to send it to a DataGridView control inside the GUI.

The tool will query Services, Processes and Shares from a Remote Computer.
You will need to specify the ComputerName and the Credential required to perform those actions. The goal is to show how to create something very simple so I did not write any Error Handling or any conditional code in this version.

One cool thing to mention when using PowerShell Studio 2012 is, if you add some controls like a DataGridView, a Listview or a ListBox, PowerShell Studio 2012 will add some functions to help you Load/Add/Refresh those controls. I will show you below in the part "Replacing the Out-Gridview by a DataGridView Control"


2013/04/02

PowerShell/WinForm - Active Directory User Unlocker


An Active Directory account may be automatically locked, if the domain's security policy has been configured to lock accounts after a number of unsuccessful logon attempts.

If an account has been locked out, the lockouttime attribute will contain a Win32 time value that indicates when the account was locked.

An easy way to search for locked out accounts is an LDAP query similar to
(&(objectClass=user)(lockoutTime=>0))




You can integrate this query in the saved queries of your Active Directory Users and Computers MMC.



Description


The following script will use PowerShell to generate a WinForm and give you the ability to unlock account right from the interface. The goal is to do something simple and functional, nothing fancy.

The GUI was created using PowerShell Studio from SAPIEN. You can try this tool by going on Sapien.com

No Module Required


The beautiful part of it is that no Active Directory Module or Quest Active Directory Snapin are required
In my case I used ADSI: [ADSISearcher]

If you want to know more about ADSISearcher check this article from the Scripting Guy

Graphical User Interface



Under Windows 8

2012/06/01

LazyWinAdmin v0.4 - Sneak Peek

Sneak peek : LazyWinAdmin v0.4

LazyWinAdmin is a PowerShell Script
This script generate a GUI/WinForm that was created using Sapien Powershell Studio.

I've been working in LWA for a while now.
This project of mine is mostly to help myself in my day to day Windows System Administrator tasks.

The goal of this tool is to centralize a lot of commands I use everyday inside a GUI and waist less time doing some tasks...
It also taking advantage of a couple of other tools Built-in in Windows: Computer Manager, Services.msc,...
And some non-built-in: Psexec, ADExplorer, SYDI-Server.vbs etc...


"General" tab contain my Top Used tools.


The "Check" button allow you to check the following connectivity item:
Ping (test-connection), Permission (test-path \\Computer\c$), RDP (Test of the port 3389), PsRemoting (PowerShell Remoting Enabled), OS (WMI), Uptime (WMI)





Autocomplete of the ComputerName. 
The script run a Get-Content on a Computers.txt when the form is loading.