Not able to create Powershell profile - psconsolefile

Hi Powershell Guru,

I am trying to create a Powershell 5.1 profile on Windows 10 Pro. with the following steps but kept encountering a persistent error:

( i ) C:\>dir c:\mypreferredconsole.psc
 
       13-Jun-18  7:10 AM               159 mypreferredconsole.psc

( ii ) The content of C:\mypreferredconsole.psc is:
      <?xml version="1.0" encoding="utf-8"?>
      <PSConsoleFile ConsoleSchemaVersion="1.0">
        <PSVersion>5.1.17134.81</PSVersion>
        <PSSnapIns />
      </PSConsoleFile>
 
( iii ) Create a shortcut on the Desktop. Make the target (the destination) of that shortcut
C:\Windows\system32\WindowsPowerShell\v1.0\powershell.exe -noexit -psconsolefile c:\mypreferredconsole.psc

Yet I kept getting the error below in a Powershell window after double clicked the shortcut :

-psconsoleFile : The term '-psconsoleFile' 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 and try again.
At line:1 char:1
+ -psconsoleFile c:\mypreferredconsole.psc
+ ~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (-psconsoleFile:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

Changing suffix .psc to .psc1 did not make any difference.

Thanks in advance,

Mary

Parents
No Data
Reply
  • Looks like it's a requirement that the file have an extension of "psc1". Other than that, I think it's just a matter of reordering your statement since Powershell seems to want the -psconsoleFile switch to be the first argument. Try this:

    C:\Windows\system32\WindowsPowerShell\v1.0\powershell.exe -psconsolefile c:\mypreferredconsole.psc1 -noexit

Children