Windows/powershell: Unterschied zwischen den Versionen

Aus SchnallIchNet
Wechseln zu: Navigation, Suche
Zeile 2: Zeile 2:
 
Snippets for powershell<br/>
 
Snippets for powershell<br/>
 
Note that Exchange-related powershell commands should be listed [[Windows/exchange|here]]<br/>
 
Note that Exchange-related powershell commands should be listed [[Windows/exchange|here]]<br/>
 +
 +
== external AD-snapin ==
 +
 +
[http://software.dell.com/products/active-roles/powershell.aspx http://software.dell.com/products/active-roles/powershell.aspx]
 +
 +
Nach der Installation dann mit folgendem command einbinden:
 +
 +
Add-PSSnapin Quest.ActiveRoles.ADManagement
 +
 +
Und damit kannst du dann tolle Sachen machen wie:
 +
 +
Get-QADGroup -ContainsMember username
 +
 +
  
 
== get loadable modules ==
 
== get loadable modules ==

Version vom 4. März 2016, 10:13 Uhr

Snippets for powershell
Note that Exchange-related powershell commands should be listed here

external AD-snapin

http://software.dell.com/products/active-roles/powershell.aspx

Nach der Installation dann mit folgendem command einbinden:

Add-PSSnapin Quest.ActiveRoles.ADManagement

Und damit kannst du dann tolle Sachen machen wie:

Get-QADGroup -ContainsMember username


get loadable modules

Get-Module -ListAvailable


Get Service names

Get-Service | Where-Object {$_.displayName.StartsWith("watch")} | Select name

get list of services that start with watch* (case sensitive)

Get-Service | Where-Object {$_.displayName.StartsWith("watch")} | Start-Service
Get-Service | Where-Object {$_.displayName.StartsWith("watch")} | Stop-Service
Get-Service | Where-Object {$_.displayName.StartsWith("watch")} | Restart-Service


Get Group Memberships of AD-Object

Get-ADPrincipalGroupMembership -identity <USER>


Filter Users

Get-ADUser -Filter * -Properties DisplayName, EmailAddress, Title -SearchBase 'OU=Fleetservices User,DC=fleetservices,DC=intra' \
-Server 'Fleetservices.intra'


or export result to CSV-File

Get-ADUser -Filter * -Properties DisplayName, EmailAddress, Title -SearchBase 'OU=HPI,DC=fleet,DC=int' \
-Server 'Fleet.int' | Export-CSV c:\temp\FleetInt.csv


set thumbnail-image

from an exchange server

Import-RecipientDataProperty -Identity dSchlenzig -Picture -FileData \
([Byte[]]$(Get-Content -path ".\thumb-DOMARI.jpg"  -Encoding Byte -ReadCount 0))


from an AD

$photo = [byte[]](Get-Content path of pic -Encoding byte)
Set-ADUser username -Replace @{thumbnailPhoto=$photo}