Some More Primal Forms tidbits


This is just a reminder for me about how to do some things with Primal Forms.
1. Include a Snapin
2. Add a new line to the $richTextbox


function OnApplicationLoad {
	#Note: This function is not called in Projects
	#Note: This function runs before the form is created
	#Note: To get the script directory in the Packager use: Split-Path $hostinvocation.MyCommand.path
	#Note: To get the console output in the Packager (Windows Mode) use: $ConsoleOutput (Type: System.Collections.ArrayList)
	#Important: Form controls cannot be accessed in this function
	#TODO: Add snapins and custom code to validate the application load
	$q = get-pssnapin Quest* -ea "silentlycontinue"
	If ($q.name -ne "Quest.ActiveRoles.ADManagement") {
	Add-PSSnapin Quest.ActiveRoles.ADManagement }
	return $true #return true for success or false for failure
}

function OnApplicationExit {
	#Note: This function is not called in Projects
	#Note: This function runs after the form is closed
	#TODO: Add custom code to clean up and unload snapins when the application exits
	
	$script:ExitCode = 0 #Set the exit code for the Packager
}

$formGetQAUsersGroups_Load={
	#TODO: Initialize Form Controls here
	
}

$butonRun = {
	$a = Get-QADMemberOf $UserBox.Text 
	foreach ($item in $a) { $item.Name | Out-File c:\useroutput.txt -Append}
	$richtextbox1.text = [string]::join([environment]::newline, (Get-Content c:\useroutput.txt))
	del c:\useroutput.txt
}

$BtnExit_Click = {
$formGetQAUsersGroups.Close()	
}

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s