You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
PSAvoidUsingInternalUrls fails on local path to Powershell.exe #268
PSAvoidUsingInternalURLs Information Once 15 'C:\WINDOWS\system32\windowspowershell\v1.0\powershel.exe'
I could see it complaining that the path was hard coded to C:\Windows instead of using $env:windir, but I should be able to write a script that accesses exe's on the local box the script runs from.
Yes, I agree with the idea. :-) I guess it is the rule name that is throwing me off. Isn't even $env:windir\system32\windowspowershell\v1.0\powershell.exe still an internal "URL"? And really, if the script specified an http: URL how would you know if it is internet accessible or only intranet accessible? Actually from some testing on Invoke-WebRequest, it seems this rule doesn't really evaluate "http" URLs. Is that right?
Should there be two rules in place of this one? One that is PSAvoidUsingInternalUNCPath and another that is PSAvoidUsingHardCodedPaths?
Activity
raghushantha commentedon Jul 13, 2015
Keith.
It is a good practice to use environment variables, instead of hardcoding windows installation path.
if you were to run this script on a machine where Windows is deployed to a drive other than C:,the script would fail.
-Raghu
rkeithhill commentedon Jul 13, 2015
Yes, I agree with the idea. :-) I guess it is the rule name that is throwing me off. Isn't even $env:windir\system32\windowspowershell\v1.0\powershell.exe still an internal "URL"? And really, if the script specified an http: URL how would you know if it is internet accessible or only intranet accessible? Actually from some testing on Invoke-WebRequest, it seems this rule doesn't really evaluate "http" URLs. Is that right?
Should there be two rules in place of this one? One that is PSAvoidUsingInternalUNCPath and another that is PSAvoidUsingHardCodedPaths?
raghushantha commentedon Aug 10, 2015
Agree. We will split the rule into two parts.
raghushantha commentedon Dec 1, 2015
Deprecating the rule considering the noise and lack of usefulness:
#389