... Home  
... Impressum
... ColorConsole

... CMD
... Netsh-XP
... Netsh-7
... Netsh-Vista
... Powershell

Download the Windows 7 Starter, Home (Basic Premium), Professional und Ultimate!


... facebook.de
 
 
ColorConsole [Version 1.7.1000] PowerShell 2.0-Export
Microsoft Windows [Version 6.1.7600]
Copyright (c) 2009 Microsoft Corporation.

C:\Windows-7>Powershell get-help Get-Unique -full

# NAME
Get-Unique

# SYNOPSIS
Returns the unique items from a sorted list.

# SYNTAX
Get-Unique [-AsString] [-InputObject <psobject>] [<CommonParameters>]

Get-Unique [-OnType] [-InputObject <psobject>] [<CommonParameters>]

# DESCRIPTION
The Get-Unique cmdlet compares each item in a sorted list to the next item, eliminates duplicates, and returns only one instance of each item. The list must be sorted for the cmdlet to work properly.

# PARAMETERS
-AsString [<SwitchParameter>]
Treats the data as a string. Without this parameter, data is treated as an object, so when you submit a collection of objects of the same type to Get-Unique, such as a collection of files, it returns just one (the first). You can use this parameter to find the unique values of object properties, such as the file names.

Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false

-InputObject <psobject>
Accepts input for Get-Unique. Enter a variable that contains the objects or type a command or expression that gets the objects.

Get-Unique treats the input submitted by using InputObject as a collection; it does not enumerate individual items in the collection. Because the collection is a single item, input submitted by using InputObject is always returned unchanged.

Required? false
Position? named
Default value
Accept pipeline input? true (ByValue)
Accept wildcard characters? false

-OnType [<SwitchParameter>]
Returns only one object of each type.

Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false

<CommonParameters>
This cmdlet supports the common parameters: Verbose, Debug,
ErrorAction, ErrorVariable, WarningAction, WarningVariable,
OutBuffer and OutVariable. For more information, type,
"get-help about_commonparameters".

# INPUTS
System.Management.Automation.PSObject
You can pipe any type of object to Get-Unique.

# OUTPUTS
System.Management.Automation.PSObject
The type of object that Get-Unique returns is determined by the input.

# NOTES

You can also refer to Get-Unique by its built-in alias, "gu". For more information, see about_Aliases.

To sort a list, use Sort-Object. You can also use the Unique parameter of Sort-Object to find the unique items in a list.

# EXAMPLE 1

C:\PS>$a = $(foreach ($line in get-content C:\Test1\File1.txt) {$line.tolower().split(" ")}) | sort | get-unique

C:\PS> $a.count

# Description
-----------
These commands find the number of unique words in a text file.

The first command gets the content of the File.txt file. It converts each line of text to lowercase letters and then splits each word onto a separate line at the space (" "). Then, it sorts the resulting list alphabetically (the default) and uses the Get-Unique cmdlet to eliminate any duplicate words. The results are stored in the $a variable.

The second command uses the Count property of the collection of strings in $a to determine how many items are in $a.

# EXAMPLE 2

C:\PS>1,1,1,1,12,23,4,5,4643,5,3,3,3,3,3,3,3 | sort-object | Get-Unique

# Description
-----------
This command finds the unique members of the set of integers. The first command takes an array of integers typed at the command line, pipes them to the Sort-Object cmdlet to be sorted, and then pipes them to Get-Unique, which eliminates duplicate entries.

# EXAMPLE 3

C:\PS>get-childitem | sort-object {$_.GetType()} | unique -OnType

# Description
-----------
This command uses the Get-ChildItem cmdlet to retrieve the contents of the local directory, which includes files and directories. The pipeline operator (|) sends the results to the Sort-Object cmdlet. The "$_.GetType()" statement applies the GetType method to each file or directory. Then, Sort-Object sorts the items by type. Another pipeline operator sends the results to Get-Unique. The OnType parameter directs Get-Unique to return only one object of each type.

# EXAMPLE 4

C:\PS>get-process | sort-object | select processname | get-unique -asstring

# Description
-----------
This command gets the names of processes running on the computer with duplicates eliminated.

The Get-Process command gets all of the processes on the computer. The pipeline operator (|) passes the result to Sort-Object, which, by default, sorts the processes alphabetically by ProcessName. The results are piped to the Select-Object cmdlet, which selects only the values of the ProcessName property of each object. The results are then piped to Get-Unique to eliminate duplicates.

The AsString parameter tells Get-Unique to treat the ProcessName values as strings. Without this parameter, Get-Unique treats the ProcessName values as objects and returns only one instance of the object, that is, the first process name in the list.

RELATED LINKS
Online version: http://go.microsoft.com/fwlink/?LinkID=113335
Select-Object
Sort-Object

C:\Windows>powershell get-help Export-PSSession -full

OS: Windows-7 / Windows-Vista // Windows Server 2008
»»»» ColorConsole


0.093
Wo finde ich die Problembehandlung in Windows-7,es soll Probleme erkennen und beheben können?  / windows 7 profesional download?  / Was bedeutet der Ordner Programme (x86) bei Windows-7?  / Hilfe, wie kann ich beim Löschen den Papierkorb umgehen?  / Wie kann ich die CDs sicher löschen?  / Wie kann ich unabsichtlich gelöschte Dateien/Daten wiederherstellen?  / Die Datenträgerverwaltung in Windows 8 öffnen bzw. starten, finden  / Was ist beim Windows Leistungsindex besser: hoch oder niedrig?  / / Lesetipp: 482  / Was ist ein RSS-Feed. Brauch ich sowas überhaupt ?  / Wie kann ich in der 'Windows-7 Startmenü Suche' ohne die Eingabe von vielen Zeichen suchen?  / Die verwendete Edition von Windows 7 ermitteln, wie geht man da vor?  / Nach der Installation von Windows-7 funktioniert der USB-Stick nicht mehr, obwohl der Rechner Sie erkennt?  / Windows-7 Schattenkopien komplett deaktivieren?  / Wo kann ich die Vista Testversion downloaden? Gibt es überhaupt eine?  /