re: [msh] get-property not working on alias
- From: lee.holmes@xxxxxxxxxxxxxxxxxxxx
- Date: Mon, 13 Mar 2006 10:16:29 -0800
This is exactly the reason why we changed the names of that cmdlet family to *-ItemProperty (coming soon to a build near you.)
These cmdlets provide access to properties of items when exposed by a certain type of Cmdlet Provider. For example, the Registry provider lets you manage values on Registry keys.
This is a slightly different concept than properties on .Net or COM objects, although one could conceptually write a provider that does understand these type of objects.
--
Lee Holmes [MSFT]
Microsoft Command Shell Development
Microsoft Corporation
This posting is provided "AS IS" with no warranties, and confers no rights.
-----Original Message-----
From: /\\/\\o\\/\\/
Posted At: Thursday, March 09, 2006 12:02 PM
Posted To: microsoft.public.windows.server.scripting
Conversation: [msh] get-property not working on alias
Subject: [msh] get-property not working on alias
while playing with get-property, I got this error :
MSH>gp alias:td
get-property : Cannot use interface. The IPropertyCmdletProvider
interface is not supported by this provider.
At line:1 char:3
+ gp <<<< alias:td
as an alias has properies see command below, I think the provider should
provide this interface.
MSH>ls alias:td | gm -membertype property
TypeName: System.Management.Automation.AliasInfo
Name MemberType Definition
---- ---------- ----------
CommandType Property System.Management.Automation.CommandTypes
CommandType {get;}
Definition Property System.String Definition {get;}
Description Property System.String Description {get;set;}
Name Property System.String Name {get;}
Options Property
System.Management.Automation.ScopedItemOptions Options {get;set;}
ReferencedCommand Property System.Management.Automation.CommandInfo
ReferencedCommand {get;}
ResolvedCommand Property System.Management.Automation.CommandInfo
ResolvedCommand {get;}
also it would be nice I think as GP will show ALL propeties
MSH>gp test.txt
Directory: Microsoft.Management.Automation.Core\FileSystem::C:\
Mode LastWriteTime Length Name
---- ------------- ------ ----
-a--- 2/20/2006 12:46 AM 28 test.txt
MSH>gi test.txt
Directory: Microsoft.Management.Automation.Core\FileSystem::C:\
Mode LastWriteTime Length Name
---- ------------- ------ ----
-a--- 2/20/2006 12:46 AM 28 test.txt
MSH> gi test.txt | gm -membertype property
now it does not make a difference what command you use, I think if you
use get-property you should not get the default formatting but all
properties like this :
MSH>gi test.txt | fl *
MshPath :
Microsoft.Management.Automation.Core\FileSystem::C:\test.txt
MshParentPath : Microsoft.Management.Automation.Core\FileSystem::C:\
MshChildName : test.txt
MshDrive : C
MshProvider : Microsoft.Management.Automation.Core\FileSystem
MshIsContainer : False
Mode : -a---
Name : test.txt
Length : 28
DirectoryName : C:\
Directory : C:\
IsReadOnly : False
Exists : True
FullName : C:\test.txt
Extension : .txt
CreationTime : 10/13/2005 9:11:47 PM
CreationTimeUtc : 10/13/2005 7:11:47 PM
LastAccessTime : 2/21/2006 7:56:07 PM
LastAccessTimeUtc : 2/21/2006 6:56:07 PM
LastWriteTime : 2/20/2006 12:46:13 AM
LastWriteTimeUtc : 2/19/2006 11:46:13 PM
Attributes : Archive
maybe that would make it a bit more usefull in this case, as now its
just the same anyway.
b.t.w. I do not think I used the get-property command much before
anyway, as in the regprovider.
my natural reaction would be more like this :
(gi .).ExecutionPolicy = 'RemoteSigned'
but in this case I get back this information :
MSH>(gi .).property
Path
ExecutionPolicy
Ok this then ;-)
MSH>(gi .).property.ExecutionPolicy
MSH>(gi .).property |gm
TypeName: System.String
hmm, Nope not much use either.
gr /\/\o\/\/
.
- References:
- [msh] get-property not working on alias
- From: /\\/\\o\\/\\/
- [msh] get-property not working on alias
- Prev by Date: Re: How to get a list of writable files using monad
- Next by Date: Re: [MSH] Requires an executable on the RHS of a pipe?
- Previous by thread: [msh] get-property not working on alias
- Next by thread: Replacing a line in a text file
- Index(es):
Relevant Pages
|
Loading