Search inside Powershell scripts

[codesyntax lang=”powershell”]

Cls
#Path
$Files = Get-ChildItem "Path to your scripts i.e C:\Powershell" -File
Foreach ($File in $Files)
	{
	$SearchString = "*Text*" #Enter search pattern here
	If (Select-String -Path $File -Pattern $SearchString)
		{Write-Host "Found $SearchString in $File $(($File.LastWriteTime).DateTime)"}
	}

[/codesyntax]

This entry was posted in Powershell. Bookmark the permalink.