Sorry for the poor subject line. I'm not sure how to word it exactly.
What I'd like to do is create some visual indicators for the users showing if a service is running or not. Maybe change a label box or picture box to red / green depending on the status? Is it possible to have this job running in the background separate from the button clicks and have it update the boxes in real time?
Powershell Studio 2015 visual indicator update real time?
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.
Re: Powershell Studio 2015 visual indicator update real time?
I'm having a hard time working this out.
Would it be best to create this function, if it should be a function, in the form_load section or before that? And then have a function for each label call on the timer?
Sorry, I'm still learning Powershell and most of my scripts have been one-liners. I still have a long ways to go...
Would it be best to create this function, if it should be a function, in the form_load section or before that? And then have a function for each label call on the timer?
Sorry, I'm still learning Powershell and most of my scripts have been one-liners. I still have a long ways to go...
Re: Powershell Studio 2015 visual indicator update real time?
I'm using this method as feedback for the end users. Right now when I click start or stop it works but it doesn't provide any indication that it's finished. So the user has to trust that it is working and remember which services they have either started or stopped.
Functions might not be what I need. I'm unsure on how to solve this problem.
Functions might not be what I need. I'm unsure on how to solve this problem.
Re: Powershell Studio 2015 visual indicator update real time?
What does that have to d with functions.
You are way too vague for me to be able to answer. What are you doing? What and how many services? What is the purpose?
You are way too vague for me to be able to answer. What are you doing? What and how many services? What is the purpose?
Re: Powershell Studio 2015 visual indicator update real time?
Sorry, not trying to be vague.
It's a small form that stop/starts about 15 different services spread over 3 different servers. The labels themselves are only there to show if the service is running. That's it.
So something like this...
If ($Service.Status -eq "Running")
{
$label1.Text = "Running"
}
Else { $label1.Text = "Stopped" }
}
I need it on a timer or something else that will automatically update the labels every X amount of seconds.
Hopefully that clears it up.
It's a small form that stop/starts about 15 different services spread over 3 different servers. The labels themselves are only there to show if the service is running. That's it.
So something like this...
If ($Service.Status -eq "Running")
{
$label1.Text = "Running"
}
Else { $label1.Text = "Stopped" }
}
I need it on a timer or something else that will automatically update the labels every X amount of seconds.
Hopefully that clears it up.
Re: Powershell Studio 2015 visual indicator update real time?
Here is an easier way to handle that..
We can also use a list view with images or a checked listbox.
- $timer_tick={
- $services= 'service1', 'service2', 'service3'
- $services=$computers|
- ForEach-Object{
- Get-Service -Computer $_ -Name $services
- } |
- select MachineName,DisplayName, Status
- $datagridview.DataSource=[collections.arraylist]$services
- }