-
Notifications
You must be signed in to change notification settings - Fork 0
PowerShell Snippets
Will Wolff-Myren edited this page Aug 19, 2019
·
2 revisions
# Get all enabled Windows Features, sorted by FeatureName
Get-WindowsOptionalFeature -Online | Where-Object State -eq "Enabled" | Sort-Object -Property "FeatureName" | Foreach { $_.FeatureName }
# https://win32.io/posts/How-To-Find-Text-PowerShell
Get-ChildItem "C:\path\to\folder" -recurse | Where-Object { (Get-Content $_) -like '*TextToFind*' } | Select-Object { $_.FullName }
# ...as a function:
function Find-TextInFiles($searchPath, $text) {
Get-ChildItem $searchPath -recurse | Where-Object { (Get-Content $_) -like '*$text*' } | Select-Object { $_.FullName }
}