by lopyeg at 2013-01-16 06:28:41
Hello guys!by ArtB0514 at 2013-01-16 07:47:35
Sorry for noob question.
How can I get all available values of the object property? My english is bad, so i append my question with an example
we have cmdlet get-service. Object cmdlets returns has a property Status.PS C:\Users\lopyeg> (get-service)[2] |get-member
TypeName: System.ServiceProcess.ServiceController
Name MemberType Definition
---- ---------- ----------
Name AliasProperty Name = ServiceName
…
Status Property System.ServiceProcess.ServiceControllerStatus Status {get;}
Question: How can I see all available values of Status (running| stopped| paused maybe)?
is it important for discovering powershell and selecting…
thank you for response
Get-Service[2] | Format-List *
by lopyeg at 2013-01-16 07:51:27it returns onlyby Klaas at 2013-01-16 07:55:38Status : Stopped
but not all vailable values of Status
Get-Service | Group status
by ArtB0514 at 2013-01-16 07:58:45So sorry, I misunderstood your question and thought you wanted all properties from a single service.by lopyeg at 2013-01-16 08:03:40
no i want to get all possible values from some propertyby lopyeg at 2013-01-16 08:07:04
i want to know does Status be equal "paused", for example
(Get-Service)[2].status |get-smthmagicby ArtB0514 at 2013-01-16 08:29:47
StatusCanBe Value
--------------- ---------
stopped
running
hanging
paused
You can only retrieve the status values that are actually in use on a system (Use Klaas’s method to achieve this). In order to find all the possible status values, whether they actually exist on a server or not, you’ll need to find it in MSDN. It looks to me like the values are in the ServiceControllerStatus enumeration. You can find it atby lopyeg at 2013-01-16 09:09:23
http://msdn.microsoft.com/en-US/library/system.serviceprocess.servicecontrollerstatus(v=vs.80).aspx
The values are]
ContinuePending
Paused
PausePending
Running
StartPending
Stopped
StopPending
[/list]
Thank you for responseby nohandle at 2013-01-16 09:34:45
the Service status was an example)
is it some cmdlet to get values of any property?
for AD objects for example?
Hi,by lopyeg at 2013-01-17 01:13:52
to be able to retrieve all of the available values they must be taken from a final set, in case of .net it is usually enum. To learn if the property you are interested in is enum look at its base type.$statusValue = Get-service | select -First 1 | select -ExpandProperty status
$statusValue.getType()IsPublic IsSerial Name BaseType
-------- -------- ---- --------
True True ServiceControllerStatus System.Enum
If the base type is enum you can use static methods of the enum class to list the available values of the type:[Enum]]
Stopped
StartPending
StopPending
Running
ContinuePending
PausePending
Paused
Thanks a lot for the helpby nohandle at 2013-01-17 01:58:53
I guess it will be interesting for all PS users
and very useful
i will write it in function.
best regards
Great. Please share it afterwardsby lopyeg at 2013-01-21 02:49:36
it seems, i am to young in PoSh)))by Infradeploy at 2013-01-21 03:20:48
i could not write a function…
if your run ‘get-service|gm’by nohandle at 2013-01-21 07:46:34
Status Property System.ServiceProcess.ServiceControllerStatus Status {get;}
And if you look up the System.ServiceProcess.ServiceControllerStatus Status .NET in Powershell:
[enum]::GetValues("System.ServiceProcess.ServiceControllerStatus")
You’ll get the values mentioned above
(Credit for this goes to Claus Nielsen)
Infradeploy:by ferry5 at 2013-03-25 22:26:12
Already said it on the first page of the topic viewtopic.php?p=4477#p4477
[quote="lopyeg"]it seems, i am to young in PoSh)))
i could not write a function…[/quote]
Give it some time, I am sure you’ll figure it out once you get bit more into PowerShell.
Will it be reliable decision to invest in arizona real estate?by ferry5 at 2013-05-06 20:49:37
Luxury Real Estate in Arizona
There are lots of ways by which we can increase our property values. Koh samui has already high rated properties.by ferry5 at 2013-05-09 23:42:12
http://www.samuiproperty.asia
What are the new prices of koh samui property? What did they do to increase their property?
http://www.samuiproperty.asia