Possible parameter values

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

Thanks in advance for help

Get-ItemPropertyValue | Get-Member

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.

Not exactly but also good hint. If I can I will continue.
I have a comment

Get-ItemPropertyValue -Path C:\Users\karol\Desktop\Migration -Name LastWriteTime,CreationTime

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.

Thx for answer

I think you need to use the following first in order to discover what you can use:

Get-ItemProperty -Path C:\Users\karol\Desktop\Migration

This should give you some objects that you can refer to when using:

Get-ItemProperty -Path C:\Users\karol\Desktop\Migration -Name LastWriteTime,CreationTime

Refer to these two links for more info:
Get-ItemProperty
Get-ItemPropertyValue

Thx you very much. A huge progress was made.
But few more questions came up :slight_smile:
First thinks first. I started with

Get-ItemProperty -Path C:\Users\karol\Desktop\Migration

and it gave me almost nothing

Directory: C:\Users\karol\Desktop

Mode LastWriteTime Length Name


d----- 15/12/2017 14:20 Migration

Bit then I find something like Format-List and it did the job.

Get-ItemProperty -Path C:\Users\karol\Desktop\Migration  | Format-List

The result was what i was looking for

Directory: C:\Users\karol\Desktop

Name : Migration
CreationTime : 05/06/2017 09:32:10
LastWriteTime : 15/12/2017 14:20:36
LastAccessTime : 15/12/2017 14:20:36
Mode : d-----
LinkType :
Target : {}

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.

Get-ItemPropertyValue -Path C:\Users\karol\Desktop\Migration -Name LastWriteTime,CreationTime,Name,Root

It worked just fine. I won’t be passing the result. The question is what is “Root”? Because i was not listed as a possible value for Name.

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.

Some of the most common basic cmdlets are Get-Help, Get-Command, Get-Member and Select-Object. (Especially Select-Object -Property *)

Here you can start learning PowerShell for free: Microsoft Virtual Academy – Getting Started with Microsoft PowerShell.
With a basic understanding of Powershell you can even find some already written scripts and adapt them for your needs.
Here you can find some: Powershell Gallery or TechNet Gallery – resources for IT professionals

Hello.
Few points

  1. I’m learning by going by some tasks. For me it is the best way.
  2. Thanks for materials. I will surely take a look on it.
  3. 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.

Best regards

I'm learning by going by some tasks.
No. You're trying to learn by guessing.
For me it is the best way.
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.

Here are a few more for you.

Microsoft Channe9
Getting Started with PowerShell 3.0 | Microsoft Docs
Shows | Microsoft Docs&lang-en=en&pubDate=year’

Windows PowerShell Survival Guide
Sign in to your Microsoft account

eBooks…
blogs.technet.microsoft.com/pstips/2014/05/26/free-powershell-ebooks
idera.com/resourcecentral/whitepapers/powershell-ebook
powershell.org/ebooks

And start with lots of examples.
powershellgallery.com
Browse code samples | Microsoft Docs
Scripting Blog - A place to learn about PowerShell and share stories of automation

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.

Thanks you all very much for help.

Hello

I Just want to say you were right. I Started from the bottom and now working in PS daily.

Mark it in calendar. Someone in the internet admitted to be wrong :slight_smile:

Best regards