Datasheet

WORK WITH OUTPUT 37
Getting Started with
Windows PowerShell
Basics
PART 1
class SPSite
{
Url = http://portal
HostHeaderIsSiteName = False
HostName = portal
[int]($_.Usage.Storage/1MB) = 5
}
e
Format-Custom
cmdlet provides an output similar to that of a class declara-
tion for an object-oriented language. Its use is very limited, and most people favor
the
Format-List
cmdlet over it.
If you try the same command using
Format-Wide
, you’ll receive an exception
because the
Format-Wide
cmdlet can take only one property at a time. To demon-
strate the
Format-Wide
cmdlet best, consider the following example, which gets
the root web located at
http://portal
and pipes all the lists to the
Format-Wide
cmdlet displaying the title of each list:
PS C:\> (Get-SPWeb http://portal).Lists | fw Title
Cache Profiles Content and Structure Rep...
Content type publishing e... Converted Forms
Customized Reports Documents
Form Templates Images
List Template Gallery Long Running Operation St...
Master Page Gallery Notification List
Pages Quick Deploy Items
Relationships List Reporting Metadata
Reporting Templates Reusable Content
Site Collection Documents Site Collection Images
Solution Gallery Style Library
Suggested Content Browser... TaxonomyHiddenList
Theme Gallery User Information List
Variation Labels Web Part Gallery
wfpub Workflow Tasks
In this example, the alias
fw
was used rather than the full name of the cmdlet.
Format-Wide
will attempt to squeeze as much information as it can into the hori-
zontal display but, in doing so, will omit considerable amounts of information, and
it is o en not used as a result.
c01.indd 37c01.indd 37 5/16/2011 11:12:35 AM5/16/2011 11:12:35 AM