I'm having a "wacky" PowerShell problem that I'm hoping someone can help me resolve. It may not really be a PowerShell issue but I've hit it twice and both times using PowerShell.
Today, I downloaded PSUnit. I followed the install instructions which includes copying the profile.ps1 into my PowerShell profile directory. The first line in the file is:
$PSUnitPath = "D:\Data\PSUnit"
After completing the install, when I open my PSUnit test in the PowerShell ISE, I get the following error:
The term ' $ P S U n i t P a t h ' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct an
d try again.
At C:\Users\sfhostingadmin.SCRUMDOMAIN\Documents\WindowsPowerShell\profile.ps1:3 char:24
+ $ P S U n i t P a t h <<<< = " D : \ D a t a \ P S U n i t " # M o d i f y t h i s p a t h t o m a t c h y o u r l o c a l P o w e r S h e l l i n s t a l l a t i o n p a t h
+ CategoryInfo : ObjectNotFound: ( $ P S U n i t P a t h :String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
Notice, it inserted a space between all of the letters. When I open the file in a text editor, the extra spaces are not there.
I get this error when simply opening the Powershell command window too i.e. where the ISE is not involved.
I don't think this is a PSUnit issue. I had this once before on a different PowerShell program where PSUnit was not involved. The only way I got around it back then was by opening a new file, and re-typing the PowerShell program.