Jump to content
EduGeek EdSec 2026 is Go! 27th Oct in Derby! Join us for a day of EdTech security focused talks, networking, and an evening social ×

Getting started with PowerShell - but error on running default profile.


Recommended Posts

Posted

I'm on windows 7 64bit.

 

I open Windows PowerShell as Administrator and "Set-ExecutionPolicy RemoteSigned"

 

I find the default profile location and created a ps1 file called "Microsoft.PowerShell_profile.ps1" with the following lines:

 

$Shell = $Host.UI.RawUI

$Shell.WindowTitle=”PowerShell Obeys Me”

$Shell.BackgroundColor=”White”

$Shell.ForegroundColor=”Blue”

$size = $Shell.WindowSize

$size.width=120

$size.height=55

$Shell.WindowSize = $size

$size = $Shell.BufferSize

$size.width=120

$size.height=5000

$Shell.BufferSize = $size

Clear-Host

 

However when I subsequently open up powershell I am greeted with the following errors:

 

Windows PowerShell

Copyright © 2012 Microsoft Corporation. All rights reserved.

 

â??PowerShell : The term 'â??PowerShell' 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 \\fp2\ja$\WindowsPowerShell\Microsoft.PowerShell_profile.ps1:2 char:20

+ $Shell.WindowTitle=â??PowerShell Obeys Meâ??

+ ~~~~~~~~~~~~~

+ CategoryInfo : ObjectNotFound: (â??PowerShell:String) [], CommandNotFoundException

+ FullyQualifiedErrorId : CommandNotFoundException

 

â??Whiteâ?? : The term 'â??Whiteâ??' 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 \\fp2\ja$\WindowsPowerShell\Microsoft.PowerShell_profile.ps1:3 char:24

+ $Shell.BackgroundColor=â??Whiteâ??

+ ~~~~~~~~~~~

+ CategoryInfo : ObjectNotFound: (â??Whiteâ??:String) [], CommandNotFoundException

+ FullyQualifiedErrorId : CommandNotFoundException

 

â??Blueâ?? : The term 'â??Blueâ??' 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 \\fp2\ja$\WindowsPowerShell\Microsoft.PowerShell_profile.ps1:4 char:24

+ $Shell.ForegroundColor=â??Blueâ??

+ ~~~~~~~~~~

+ CategoryInfo : ObjectNotFound: (â??Blueâ??:String) [], CommandNotFoundException

+ FullyQualifiedErrorId : CommandNotFoundException

 

PS H:\>

Posted
Indeed - weird - when opening up the PS1 file in Notepad it looked fine, but when opening up in the ISE the " in some cases had changed to the weird characters...not sure why but it's sorted now - thanks.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...