Hello
I just started learning PS
One issue is bothering. For example:
we have a comment like: Get-ItemPropertyValue
and it has Required parameter Name. I found an example that we can you it like
-Name LastWriteTime,CreationTime,Root
and here is my question. How can I find a list of possible options to by use for “Name” parameter
You will get prompted for a value, just type name and enter twice and you should see a list of methods and properties. That is if I’m understanding what it is you are seeking.
There’s no fixed list of what -Name will accept. It depends on what you are working with. For example, in the file system versus the registry versus something else. So you have to - as suggested above - retrieve something and ask for a member list.
This are two property names “LastWriteTime,CreationTime” i have found over internet. I would like to know how, in this example, am I to find other values that can be passed to “Name”.
The “Get-Member” gives me type of the member and the of its methods and properties.
So the first question is why i haven’t seen anything without Formatting? Based on my understanding from other languages it should show us something. Not formatted, but something.
So i was able to came up with something like this.
Karol,
I’d like to ask you to start learning the basics of Powershell first. In this process you will learn as well how to get some information about objects and how to use them. I think it is beyond the scope of this forum to teach you one cmdlet at a time.
I’m learning by going by some tasks. For me it is the best way.
Thanks for materials. I will surely take a look on it.
I don’t believe this thread is above or below this forum. I’m asking question and someone is helping me. Maybe some people who are also starting will find it useful. Don’t like to post, don’t read it. It is that simple. If you believe topic or the way post is formatted is against the rules please feel free to report it to forum moderator/admin.
Sorry - in my opinion you're wrong with that conclusion.
If you start learning the basics of Powershell all what you’ve asked will be clear in the first lessions. At least try the first lessions of the MVA course please.
There are a couple of things to pull into focus here. Let’s step though and show you what I mean. Run the below and see what you get back.
Starting with stuff like using the built-in help files.
Even if you choose not to read it all (which you should), at minimum look at all the parameters and examples.
Get-Help -Name Get-ItemProperty -Full
Get-Help -Name Get-ItemProperty -Examples
Then info on the cmdlet / function you are trying to use
(Get-Command -Name Get-ItemProperty).Parameters
Then what you can use the cmdlet/function on.
Get-ItemProperty -Path D:\Temp | Format-Table -AutoSize -Wrap
Get-ItemProperty -Path D:\Temp | Format-List
Get-ItemProperty -Path D:\Temp | Format-List -Force
Get-ItemProperty -Path D:\Temp | Select-Object -Property *
(Get-ItemProperty -Path D:\Temp) | Get-Member
You often cannot do just one thing and get all you need for X or Y, you have to expand your need approach to extrapolate data points.
It’s ok to experiment / try things, but ensure you do some prep before doing so as you can lead yourself to unnecessary frustration. PoSH is all about discovery (lots of trial, error, hacking and kludges sometimes). Yet taking a singular focus approach, well, is just painful and taking a look at how others have done things is always a good thing. Everyone learns from everyone, regardless of level. If you are like me, I am first and foremost a visual learner, YouTube, MS Channel9, TechNet virtual labs, and the stuff Olaf points to are good things.
Looking at the .ps* files already on your system. There are bunches of them located here:
C:\Windows\System32\WindowsPowerShell\v1.0
Just make a copy of that and open in the PowerShell_ISE.exe and review them.
Heck even in the ISE just hit CRTL+J to see a list of prebuilt snippets to review and understand.