Skip to content

PSAvoidUsingInternalUrls fails on local path to Powershell.exe #268

Closed

Description

This can't be right:

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.

Activity

  1. raghushantha commented on Jul 13, 2015

    @raghushantha
    Member

    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

  2. rkeithhill commented on Jul 13, 2015

    @rkeithhill
    ContributorAuthor

    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?

  3. raghushantha commented on Aug 10, 2015

    @raghushantha
    Member

    Agree. We will split the rule into two parts.

  4. raghushantha commented on Dec 1, 2015

    @raghushantha
    Member

    Deprecating the rule considering the noise and lack of usefulness:
    #389

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions