# Looking for explanation on something

**URL:** <https://forums.powershell.org/t/looking-for-explanation-on-something/20714>\
**Category:** PowerShell Help\
**Created:** [October 21, 2022, 12:23pm UTC](https://forums.powershell.org/t/looking-for-explanation-on-something/20714 "2022-10-21T12:23:00Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![turbo-mcp](https://avatars.discourse-cdn.com/v4/letter/t/58f4c7/32.png) [@turbo-mcp](https://forums.powershell.org/u/turbo-mcp)\
**Post date:** [October 21, 2022, 12:23pm UTC](https://forums.powershell.org/t/looking-for-explanation-on-something/20714/1 "2022-10-21T12:23:00Z")

</div>

Hi there  
i have a script that finds the template name of a certificate and it works:

> Blockquote  
> Get-ChildItem ‘Cert:\LocalMachine\My’ | Where-Object{ $_.Extensions | Where-Object{ ($_.Oid.FriendlyName -eq ‘Certificate Template Information’) -and ($\_.Format(0) -match $templateName) }}

im trying to understand what this part does:  
$\_.Format(0)

thanks

---

<div class="post-metadata">

**Author:** ![Olaf](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/olaf/32/992_2.png) [@Olaf](https://forums.powershell.org/u/Olaf)\
**Post date:** [October 21, 2022, 2:54pm UTC](https://forums.powershell.org/t/looking-for-explanation-on-something/20714/2 "2022-10-21T14:54:15Z")

</div>

> [@turbo-mcp](#):
>
> im trying to understand what this part does:  
> $\_.Format(0)

Short answer: it calls the method `.Format()` with the parameter `0` on the `Extensions` property of a certificate object.

How can you figure that out by yourself? …

Running …

```auto
Get-ChildItem 'Cert:\LocalMachine\My'

```

… outputs some objects of a certain type. They have some properties and some methods. To inspect it and display these methods and properties you can use `Get-Member`. And because one object is enough we use the first object the cmdlet returns for the further steps here.

```auto
(Get-ChildItem 'Cert:\LocalMachine\My')[0] | 
    Get-Member

```

The output you get will have pretty likely a property named `Extensions`. So we use `Get-Member` again on that property:

```auto
(Get-ChildItem 'Cert:\LocalMachine\My')[0].Extensions | 
    Get-Member

```

This output should have the method `.Format()` you was looking for.

To figure out what this method exactly does you could try to find a documentation or you simply play around a little bit. 😉

```auto
(Get-ChildItem 'Cert:\LocalMachine\My')[0].Extensions.Format(0)

```

or

```auto
(Get-ChildItem 'Cert:\LocalMachine\My')[0].Extensions.Format(1)

```

or

```auto
(Get-ChildItem 'Cert:\LocalMachine\My')[0].Extensions.Format(2)

```

Cool? 👍🏽 🤟🏽

---

<div class="post-metadata">

**Author:** ![turbo-mcp](https://avatars.discourse-cdn.com/v4/letter/t/58f4c7/32.png) [@turbo-mcp](https://forums.powershell.org/u/turbo-mcp)\
**Post date:** [October 21, 2022, 4:06pm UTC](https://forums.powershell.org/t/looking-for-explanation-on-something/20714/3 "2022-10-21T16:06:07Z")

</div>

yeah i did all that but still couldnt exactly figure out why when i goto .extensions i see bunch of stuff  
when i use .format(0) i see stuff that i dont even see in .extensions

---

<div class="post-metadata">

**Author:** ![Olaf](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/olaf/32/992_2.png) [@Olaf](https://forums.powershell.org/u/Olaf)\
**Post date:** [October 21, 2022, 4:32pm UTC](https://forums.powershell.org/t/looking-for-explanation-on-something/20714/4 "2022-10-21T16:32:45Z")

</div>

> [@turbo-mcp](#):
>
> when i use .format(0) i see stuff that i dont even see in .extensions

Of course. It’s like a closet with drawers with boxes in it. When you open the closet you can see the drawers but not the boxes. You have to open the drawers to access the boxes. And the boxes to access their content. 😉

---

<div class="post-metadata">

**Author:** ![dotnVo](https://avatars.discourse-cdn.com/v4/letter/d/4af34b/32.png) [@dotnVo](https://forums.powershell.org/u/dotnVo)\
**Post date:** [May 16, 2024, 8:16pm UTC](https://forums.powershell.org/t/looking-for-explanation-on-something/20714/5 "2024-05-16T20:16:30Z")

</div>


