windows:pstriks
Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
windows:pstriks [2012/12/11 08:30] – created larserik | windows:pstriks [2018/10/20 23:00] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== Powershelltriks ====== | ====== Powershelltriks ====== | ||
+ | |||
+ | ==== Alle nøstede gruppemedlemskaper til en bruker ==== | ||
+ | <code powershell> | ||
+ | $username = ' | ||
+ | $dn = (Get-ADUser $username).DistinguishedName | ||
+ | Get-ADGroup -LDAPFilter (" | ||
+ | </ | ||
==== Finn brukernavnet til en SID ==== | ==== Finn brukernavnet til en SID ==== | ||
<code powershell> | <code powershell> | ||
$objSID = New-Object System.Security.Principal.SecurityIdentifier(" | $objSID = New-Object System.Security.Principal.SecurityIdentifier(" | ||
- | $objUser = $objSID.Translate( [System.Security.Principal.NTAccount]) | + | $objUser = $objSID.Translate( [System.Security.Principal.NTAccount] ) |
$objUser.Value | $objUser.Value | ||
+ | </ | ||
+ | |||
+ | ==== Tail ekvivalent ==== | ||
+ | **Follow** | ||
+ | <code powershell> | ||
+ | Get-Content -Patch "< | ||
+ | </ | ||
+ | |||
+ | **Standard tail, print 10 siste** | ||
+ | <code powershell> | ||
+ | Get-Content <fil> | Select-Object -Last < | ||
+ | </ | ||
+ | |||
+ | ==== Finn og drep prosesser ==== | ||
+ | <code powershell> | ||
+ | gps < | ||
+ | Get-Process -Name < | ||
+ | </ | ||
+ | |||
+ | ==== Kjør kommandoer på en remote server ==== | ||
+ | <code powershell> | ||
+ | Invoke-Command -ComputerName < | ||
+ | </ | ||
+ | |||
+ | ==== Rename mengder av filer ==== | ||
+ | <code powershell> | ||
+ | Get-ChildItem *.jpg | % { Rename-Item $_ $_.Name.Replace(" | ||
</ | </ |
windows/pstriks.1355211003.txt.gz · Last modified: (external edit)