SharePoint Experts, Information Architects, Expert Witness

We provide consulting in a broad array of business and technology from architecture to design to deployment of global systems with a focus on surfacing data in the enterprise. Specialists in Microsoft, we are a premier provider of SharePoint Expertise (including 2016 and Office 365). We also provide Expert Witness/Legal Expert in eDiscovery, source discovery, patent infringement, piracy and more! We also have established SICG DLDS s.a. - our counterpart in Costa Rica that specializes in water systems ( - Contact me direct: or call 704-873-8846 x704.

Search This Blog

Friday, July 15, 2011

Annoyances in PowerShell

So you are trying to run a PowerShell and keep getting:

Suggestion [3,General]: The command <script file> was not found, but does exist in the current location. Windows PowerShell doesn't load commands from the current location by default. If you trust this command, instead type ".\<script>.ps1". See "get-help about_Command_Precedence" for more details.

This generic error is pretty much what you will see for anything, even if the file does not exist. One of my clients was trying to run Invoke-AlertFixup in SharePoint and kept getting this error even when correctly opening it as:


The fix is quite simple - simply enter:

$env:PATH = $env:PATH + "."

then enter the .\<script>.ps1 - Viola!


Anonymous said...

This is really really old, but I see a lot of people still having issues. I notices your solution does get rid of the error, but the command still does not work properly after implementing it. The actual issue is that the invoke command should begin with period, space, period; instead of just one period. Hope it helps someone.

Anonymous said...

I appreciate all the comments however I have run many suggestions:
Running as administrator,
Setting Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass (and confirmed Y)
Setting Import-Module GroupPolicy which returns me to the shell/command prompt
Setting $env:PATH=$env:PATH+">"
Typing one command to run it which returned:
...if you want to trust this command, instead type ".\Get-DomainKerberosPolicy.ps1"
, I did and it just returns me to the PS F:\psscripts prompt
So I typed ".\Get-DomainKerberosPolicy.ps1" but it returned me to the prompt.
So I typed
PS F:\psscripts> . .\Get-DomainKerberosPolicy.ps1
but that too just returned me to the prompt.

I tried a number of pre-canned scripts and nothing happens. Sorry, but the answer is still elusive.