Showing posts with label PrimalForms. Show all posts
Showing posts with label PrimalForms. Show all posts

Wednesday, January 7, 2009

Verify PSSnapin (Script vs PrimalForms)

When running a script from the console or the various IDE's, you can check for a specific snap-in with the #requires statement. See ALEKSANDAR's blog post for the complete description.

When running a script as a winform (like through PrimalForms), you may need to attack from a different angle. It may be necessary to capture the fact that a particular snap-in is not installed and present it in the GUI or a messagebox. For this the following may be a better approach:
$snapin = "Quest.ActiveRoles.ADManagement"
if ((get-pssnapin -name $snapin -erroraction silentlycontinue) -eq $null)
{
$statusBar1.text =
"$snapin is not installed"
}
Enjoy!

Monday, January 5, 2009

PrimalForms & PowerShell AD Tool

We are in the middle of a file migration and our policy dictates that as our file shares are moved they need to have the following structure:
  • Access.Neurosurgery.Public.Change
  • Access.Neurosurgery.Public.Full
  • Access.Neurosurgery.Public.Read
So every time a new group is requested, the admin has to create 3 distinct groups, assign the scope & type and add the "Managed By" username. Not hard, but time consuming. This looked like a great candidate for PrimalForms!

The UI is pretty straight forward. It asks for the group name, the scope and the owner.


When the Verify Group button is pressed, we perform a few checks before we create the groups. First we check to see if there are similar groups. In this case, the panel is now visible and the status bar indicates that like groups already exist.


Once we verify the group name, we need to verify that the entered group owner is in fact a legitimate AD object.


In this case, the user is not valid. Once all the data is verified, we give the user one last chance to cancel before the groups are created.


That's about it!

Enjoy!

Monday, December 15, 2008

PrimalForms Example (Virtual Center Log)

Recently saw a post on Twitter from alanrenouf. He was asking if there was a log file that could be parsed to search for who deleted a VM. I know that this data was kept in the Virtual Center Database, specifically in the VPX_EVENT table. I mentioned this to Alan and he quickly wrote a PowerShell script to find the data and blogged it.
Concurrently, I was investigating PrimalForms (PowerShell UI builder - FREE). Once I saw Alan's post, I knew it would be a good example to try PrimalForms with.

The UI was simple to create with PrimalForms, here is a screenshot of the UI.

The dropdowns are filled on the form load with the following:
- Distinct Virtual Machine
- Distinct User
- Distinct Event (in Alan's case vim.event.VmRemovedEvent)
- Search Start Date
- Search End Date


Selecting the above variables generates the SQL statement to the VPX_EVENT table. The results are then passed to the datagrid.




Pretty cool!


As soon as I figure out how to attach a text file to Blogger, I will do so. In the short-term, if you are interested in the script(s), send me a note at stahler.2@osu.edu.

Enjoy!