If your goal is to use Get-ChildItem for the server you selected, it would help to provide the correct string format.
For example, instead of using;
Get-ChildItem $comboboxServers.selecteditem
Try the following example:
$serverpath = '\\'+"$($comboboxServers.selecteditem)"+'\c$';
Get-ChildItem $serverpath
See it this will give you the expected result.
get-childitem combobox
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.
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.
- apowershelluser
- Posts: 194
- Last visit: Mon Apr 15, 2024 3:21 pm
Re: get-childitem combobox
It's working as I imagedmxtrinidad wrote: ↑Fri Dec 01, 2017 8:36 am If your goal is to use Get-ChildItem for the server you selected, it would help to provide the correct string format.
For example, instead of using;
Get-ChildItem $comboboxServers.selecteditem
Try the following example:
$serverpath = '\\'+"$($comboboxServers.selecteditem)"+'\c$';
Get-ChildItem $serverpath
See it this will give you the expected result.
I don't need to do a $serverpath because comoboxbox is populated with the full path
\\server\data\user
\\server\data\user2
etc...
Re: get-childitem combobox
For an example on how to use the Job-Tracker, use the Button - Start Job control set or refer to the following article:
https://info.sapien.com/index.php/guis/ ... sive-forms
https://info.sapien.com/index.php/guis/ ... sive-forms
David
SAPIEN Technologies, Inc.
SAPIEN Technologies, Inc.
Re: get-childitem combobox
Start-JobTracker Takes a parameter "-ArgumentList" which is passed to the JobTracker script block as an argument. Use this to pass the value as the default argument in you script block,
From the code you posted:
This is what I meant by reading the help comments. You had them and posted them but were not reading them.
From the code you posted:
Code: Select all
Add-JobTracker -ArgumentList $comboboxServers.selecteditem -Name 'JobNameQueryServer' `
-JobScript {
#--------------------------------------------------
#TODO: Set a script block
#Important: Do not access form controls from this script block.
Param ($Argument1) #Pass any arguments using the ArgumentList parameter
# ---------------------------------
# Sample Code to Load Sortable Data
# ---------------------------------
Get-ChildItem $Argument1
#--------------------------------------------------
}`
- apowershelluser
- Posts: 194
- Last visit: Mon Apr 15, 2024 3:21 pm
Re: get-childitem combobox
I started with that control set and worked my way up. The problem as stated in my next post is there's not true example. Is it lack of my understanding? I can understand that, but to not make an update to that blog, that explicitly deals with arguments creates most of these threads.davidc wrote: ↑Fri Dec 01, 2017 9:30 am For an example on how to use the Job-Tracker, use the Button - Start Job control set or refer to the following article:
https://info.sapien.com/index.php/guis/ ... sive-forms
All of you are top notch. Just remember, some of us are just starting and only need a few examples to wrap our heads around it.
Last edited by apowershelluser on Fri Dec 01, 2017 10:28 am, edited 1 time in total.
- apowershelluser
- Posts: 194
- Last visit: Mon Apr 15, 2024 3:21 pm
Re: get-childitem combobox
That sentence is laughable. Do me a favor, show me in the help or the blog post where it gives an example.jvierra wrote: ↑Fri Dec 01, 2017 10:00 am Start-JobTracker Takes a parameter "-ArgumentList" which is passed to the JobTracker script block as an argument. Use this to pass the value as the default argument in you script block,
From the code you posted:
This is what I meant by reading the help comments. You had them and posted them but were not reading them.Code: Select all
Add-JobTracker -ArgumentList $comboboxServers.selecteditem -Name 'JobNameQueryServer' ` -JobScript { #-------------------------------------------------- #TODO: Set a script block #Important: Do not access form controls from this script block. Param ($Argument1) #Pass any arguments using the ArgumentList parameter # --------------------------------- # Sample Code to Load Sortable Data # --------------------------------- Get-ChildItem $Argument1 #-------------------------------------------------- }`
Re: get-childitem combobox
The link David posted is a clear example and the text I just posted explains and shows an exact example.
I will highlight it for you:
Add-JobTracker -ArgumentList $comboboxServers.selecteditem -Name 'JobNameQueryServer'
and
Get-ChildItem $Argument1
I will highlight it for you:
Add-JobTracker -ArgumentList $comboboxServers.selecteditem -Name 'JobNameQueryServer'
and
Get-ChildItem $Argument1
Re: get-childitem combobox
If you read the blog post carefully you will see an explicit example. The "Function Add-JobTracker" has the arguments and the example right at the top starting with:
And:.PARAMETER ArgumentList
The arguments to pass to the job
And:#Start the Job
$job = Start-Job -Name $Name -ScriptBlock $JobScript -ArgumentList $ArgumentList
$buttonStartJob_Click={
$buttonStartJob.Enabled = $false
#Create a New Job using the Job Tracker
Add-JobTracker -Name "JobName" `
-JobScript {
#--------------------------------------------------
#TODO: Set a script block
#Important: Do not access form controls from this script block.
Param($Argument1)#Pass any arguments using the ArgumentList parameter
- apowershelluser
- Posts: 194
- Last visit: Mon Apr 15, 2024 3:21 pm
Re: get-childitem combobox
You mean in this link, https://info.sapien.com/index.php/guis/ ... sive-forms
There is an real example of using arguments?
Hmm, I see 4 examples of -argument and 18 uses of the word argument
Guess I need to go back to elementary
There is an real example of using arguments?
Hmm, I see 4 examples of -argument and 18 uses of the word argument
Guess I need to go back to elementary
- apowershelluser
- Posts: 194
- Last visit: Mon Apr 15, 2024 3:21 pm
Re: get-childitem combobox
Yes, I saw all of these, none of the provide the example for the argument - so you're skipping the most important partjvierra wrote: ↑Fri Dec 01, 2017 11:05 am
If you read the blog post carefully you will see an explicit example. The "Function Add-JobTracker" has the arguments and the example right at the top starting with:
And:.PARAMETER ArgumentList
The arguments to pass to the job
And:#Start the Job
$job = Start-Job -Name $Name -ScriptBlock $JobScript -ArgumentList $ArgumentList
$buttonStartJob_Click={
$buttonStartJob.Enabled = $false
#Create a New Job using the Job Tracker
Add-JobTracker -Name "JobName" `
-JobScript {
#--------------------------------------------------
#TODO: Set a script block
#Important: Do not access form controls from this script block.
Param($Argument1)#Pass any arguments using the ArgumentList parameter
I guess as the posts starts " This article will not cover the ins and outs of jobs and it expects the user has some basic knowledge of the jobs mechanism in PowerShell. "