I really hope someone can just give me a pre-made solution for this
I have tried this…
if {exists file "C:\BigFixTemp\netcheck.ps1"}
delete "C:\BigFixTemp\netcheck.ps1"
endif
if {exists file "C:\BigFixTemp\netcheck.txt"}
delete "C:\BigFixTemp\netcheck.txt"
endif
delete __Download\netcheck.ps1
createfile until EOF
try {{
$wc = New-Object System.Net.WebClient
$wc.Proxy.Credentials = [System.Net.CredentialCache]::DefaultNetworkCredentials
$wc.DownloadString("http://www.google.com") | Out-Null
"Total Success" | Out-File -FilePath "C:\BigFixTemp\netcheck.txt" -Encoding ASCII
} catch {{
"Failed" | Out-File -FilePath "C:\BigFixTemp\netcheck.txt" -Encoding ASCII
}
EOF
copy __createfile C:\BigFixTemp\netcheck.ps1
waithidden {pathname of file ((it as string) of value "Path" of key "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\PowerShell\1\ShellIds\Microsoft.PowerShell" of native registry)} -executionpolicy remotesigned -File "C:\BigFixTemp\netcheck.ps1"
It works but the problem is that an individual user on the endpoint may well have a proxy set and thus they have access to the internet so this would never detect that.
The other problem is that the proxy a user might have set - may not even work so I can’t just assume that by having a proxy configured they have access to the internet.
I’m really hoping someone has had this issue before and can help?