PS C:/> get-alias dir
PS C:/> get-childitem C:/
get-childitem |format-list
get-childitem C:/ | format-list -property name
get-childitem C:/ | format-list -property name, length
get-childitem C:/ | format-wide
get-childitem C:/Windows
get-childitem C:/Windows -recurse -include *.txt
get-childitem C:/Windows -recurse -include *.txt |format-wide -column 3
get-childitem C:/Windows -recurse -include *.txt |format-wide -property
name -groupby length -column 3
get-childitem C:/ | format-table
get-childitem C:/Windows
get-childitem C:/Windows -recurse -include *.txt
get-childitem C:/Windows -recurse -include *.txt |format-tableget-childitem C:/Windows -recurse -include *.txt |format-table -property
name, length, lastwritetime
get-command *
get-alias g*
gcm get-command
gcm get-command |format-list *
gcm get-command | format-list -property definition
(gcm get-command).definition
gcm -verb se*
gcm -noun o*
gcm -syntax get-command
gcm -syntax gcm
Get-Command
get-childitem C:/ | get-member
get-alias g*
gal g*
gal g* |sort-object -property definition
gci | gm
get-childitem | get-member -membertype property
get-childitem | get-member -membertype method
get-childitem | get-member -membertype m*
$wshShell = new-object -comobject "wscript.shell"
$wshShell.run("calc.exe")
$wshShell.ExpandEnvironmentStrings("%windir%")
test-path $profile
new-item -path $profile -itemtype file -force
notepad $profile
Set-alias gh get-help
function pro {notepad $profile}
gal | where-object {$_.definition -match "get-childitem"}
gci
gci | where-object {$_.length -gt 1000}
cls
gal cls
gal mred
clear-host
get-childitem | get-member -membertype property
get-childitem | where-object {$_.LastWriteTime}
get-childitem | where-object {$_.LastWriteTime -gt "12/25/2006"}
get-childitem "C:/fso"| where-object {$_.LastWriteTime -gt "12/25/2006"}
get-childitem -recurse "C:/fso"| where-object {$_.LastWriteTime -gt "12/25/2006" }
$wshnetwork = new-object -comobject "wscript.network"
$wshnetwork.EnumPrinterConnections()
$wshnetwork.EnumNetworkDrives()
$colPrinters = $wshnetwork.EnumPrinterConnections()
$colDrives = $wshnetwork.EnumNetworkDrives()
$userName = $wshnetwork.UserName
$userDomain = $wshnetwork.UserDomain
$computerName = $wshnetwork.ComputerName
$wshShell = new-object -comobject "wscript.shell"
$wshShell.Popup($userDomain+"/$userName $computerName")
$wshShell.Popup($colPrinters)
$wshShell.Popup($colDrives)
3.##################################################################################################Leveraging PowerShell Providers
Get-PSProvider
sl alias:/
GCI
GCI | Where-Object {$_.name -like "s*"}
Get-ChildItem |Get-Member
GCI | Where-Object {$_.definition -like "set*"}
GCI | Where-Object {$_.name -like "*w*"}
GCI | where {$_.name -like "*w*"}
Set-Location cert:/
Get-ChildItem
Get-ChildItem -recurse
GCI -path currentUser
sl currentuser/authroot
GCI | where {$_.subject -like "*c&w*"}
GCI | where {$_.subject -like "*SGC Root*"}
GCI | where {$_.thumbprint -eq "F88015D3F98479E1DA553D24FD42BA3F43886AEF"}
GCI | where {$_.thumbprint -eq "F88015D3F98479E1DA553D24FD42BA3F43886AEF"} |Format-List *
Certmgr.msc
Invoke-Item cert:/
Get-PSDrive
Set-Location env:/
Get-Item *
get-item * | Sort-Object -property name
get-item windir
get-item windir | Format-List *
GI * | Sort -Property Name
New-Item -Path . -Name admin -Value mred
Get-Item admin
Get-Item admin | Format-List *
GCI | Sort -Property name
New-Item -Path . -Name admin -Value mred
Rename-Item -Path env:admin -NewName super
GCI | Sort -Property name
New-Item -Path . -Name super -Value mred
Remove-Item super
GCI C:/
GCI C:/ | where {$_.psiscontainer}
GCI C:/ | where {!$_.psiscontainer}
GCI -Path C:/ | GM
GCI -Path C:/ | GM | Where {$_.membertype -eq "property"}
GCI -Path C:/ | GM | where {$_.membertype -eq "property" -AND $_.typename -like "*file*"}
GI * | Where {$_.PsisContainer -AND $_.name -Like "*my*"}
RI mytest -recurse
GI * | Where {$_.PsisContainer -AND $_.name -Like "*my*"}
New-Item -Path C:/ -Name mytest -Type directory
New-Item -Path C:/mytest -Name myfile.txt -type file
RI -Path C:/mytest/myfile.txt
New-Item -Path C:/mytest -Name myfile.txt -Type file -Value "My file"
Get-Content C:/mytest/myfile.txt
Add-Content C:/mytest/myfile.txt -Value "ADDITIONAL INFORMATION"
Get-Content C:/mytest/myfile.txt
Set-Content C:/mytest/myfile.txt -Value "Setting information"
Get-Content C:/mytest/myfile.txt
Set-Location function:/
GCI
GCI | Where {$_.definition -like "set*"}
GCI | Where {$_.definition -notlike "set*"}
Get-Content md
get-psDrive | where {$_.Provider -like "*Registry*"}
GCI -path HKLM:/software
GCI -Path 'HKLM:/SOFTWARE/Microsoft/Windows NT/CurrentVersion/HotFix'
GCI -Path 'HKLM:/SOFTWARE/Microsoft/Windows NT/CurrentVersion/HotFix' | where {$_.Name -like "*KB928388"}
Get-Help *variable | Where-Object {$_.category -eq "cmdlet"}
Get-Help *variable | Where-Object {$_.category -eq "cmdlet"} | Format-List name, category, synopsis
SL variable:/
Get-ChildItem
Get-ChildItem | Sort {$_.Name}
Get-Variable ShellId
Get-Variable ShellId | Format-List *
New-Variable administrator
Get-Variable administrator
Set-Variable administrator -value mred
Get-Variable administrator
Remove-Variable administrator
Get-Variable administrator
Get-ChildItem |Get-Member | Where-Object {$_.membertype -eq "property"}
Get-PSDrive |where {$_.name -like "c*"}
Sl cert:/
GCI
GCI -recurse
GCI -recurse >C:/a.txt;notepad.exe a.txt
new-PSDrive -name al -PSProvider alias -Root.
SL al:/
GCI | Sort -Property name
GCI | sort -Property name | Where {$_.Name -gt "t"}c
SL C:/
Remove-PSDrive al
Get-PSDrive
Get-Item -Path env:/
Get-Item -Path env:/ | Get-Member
$objEnv=Get-Item -Path env:/
$objEnv.Count
$objEnv.Get_count
$objEnv.Get_count()
$objEnv.GetType()