Skip to content

Instantly share code, notes, and snippets.

@lukeawyatt
Last active June 21, 2021 16:10
Show Gist options
  • Save lukeawyatt/bebfbef75c6aa51c0c035c84fcf0f846 to your computer and use it in GitHub Desktop.
Save lukeawyatt/bebfbef75c6aa51c0c035c84fcf0f846 to your computer and use it in GitHub Desktop.
Shell: PowerShell
# MODIFY TO YOUR SOURCE FILE EXTENSIONS
cd C:\projectdirectory
(dir -include *.cs,*.xaml -recurse | select-string .).Count
Function Pinghost  ([ string] $Hostname )
{
$status=get-wmiobject win32_pingstatus -Filter "Address=' $Hostname'" | Select-Object statuscode
if($status .statuscode -eq 0)
{write-host $Hostname is REACHABLE -background "GREEN" -foreground "BLACk"}
else
{write-host $Hostname is NOT reachable -background "RED" -foreground "BLACk" }
}
(New-Object -COM Shell.Application).WindowsSecurity()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment