Textbox and GUI for workflow

Ask questions about creating Graphical User Interfaces (GUI) in PowerShell and using WinForms controls.
Forum rules
Do not post any licensing information in this forum.

Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
This topic is 6 years and 5 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked
User avatar
davidbry
Posts: 1
Last visit: Fri Oct 13, 2017 5:35 am

Textbox and GUI for workflow

Post by davidbry »

Product, version and build: PowerShell Studio 2017 v5.4.143
32 or 64 bit version of product: x64
Operating system: Windows 10 15063
32 or 64 bit OS: x64

Hi,
Very new to powershell studio and trying to build a simple GUI for a powershell workflow script.

Image

The workflow is to startup and shutdown VMs in Azure Resource Manager on schedules controlled by tags. The workflow has a list of parameters as below.

Code: Select all


workflow Set-AzureRmVmPowerState
{
	Param (
		[Parameter(Mandatory = $false)]
		[string]$SubscriptionName = '********',
		[b][Parameter(Mandatory = $false)]
		[string]$resourceNameFilter,
		[Parameter(Mandatory = $false)]
		[string]$resourceGroupFilter,
[/b]		[Parameter(Mandatory = $false)]
		[bool]$TestOnly = $true,
		[Parameter(Mandatory = $false)]
		[string]$ShutdownWindowTagName = 'ShutdownSchedule',
		[Parameter(Mandatory = $false)]
		[string]$ShutdownStartEnabledTagName = 'ShutdownSchedule_AllowStart',
		[Parameter(Mandatory = $false)]
		[string]$ShutdownStopEnabledTagName = 'ShutdownSchedule_AllowStop',
		[Parameter(Mandatory = $false)]
		[string]$VMPowerStateCategory = 'Powerstate_Category',
		[string]$TimeZone = 'GMT Standard Time',
		[string]$VerboseAction = 'Continue'
	)



The GUI has 2 textboxes with a label for each identifying them.
Each text box is for input value for a parameter within the workflow. One for virtual machines and one for an a resource group. (Container for virtual machine).
The textboxes are Named $resNameFilter and $resGroupFilter

I know how to retrieve the text from the text boxes but I am unsure how to pass the text inputted into the text box through to the parameter in the workflow.
$resourceNameFilter
$resourceGroupFilter

The workflow will start but will not do the necessary filtering without the textboxes working as I need.

I also tried a to pass the text box input through to a simple function to test and this did not work so it seems like a scoping issue. I know workflows run within their own scope and also parallel processing within the workflow will also.

Any help or direction in where to find help from would be appreciated.

Davie

DO NOT POST SUBSCRIPTIONS, KEYS OR ANY OTHER LICENSING INFORMATION IN THIS FORUM
User avatar
Alexander Riedel
Posts: 8479
Last visit: Thu Mar 28, 2024 9:29 am
Answers: 20
Been upvoted: 37 times

Re: Textbox and GUI for workflow

Post by Alexander Riedel »

[Moved to correct forum by moderator]
Alexander Riedel
SAPIEN Technologies, Inc.
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

Re: Textbox and GUI for workflow

Post by jvierra »

Set-AzureRmVmPowerState -resourceGroupFilter $resourceGroupFilter.Text -]resourceNameFilter ]$resourceNameFilter.Text
This topic is 6 years and 5 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked