user1790927
user1790927

Reputation: 13

Userprofile messed up

I have a little problem here with my user profile path for the use with powershell. I have set my profile.ps1 to this:

$Shell = Host.UI.RawUI
$Shell.WindowTitle="PowerShell obeys me!"
$Shell.BackgroundColor="White"
$Shell.ForegroundColor="Blue"
$size = $Shell.WindowSize
$size.width=120
$size.height=50
$Shell.WindowSize = $size
$size = $Shell.BufferSize
$size.width=120
$size.height=5000
$Shell.BufferSize = $size

but everytime i execute run poweshell, it shows some erors like this one:

Property 'WindowTitle' cannot be found on this object; make sure it exists and is settable.
At D:\data\d7bighs\Documents\WindowsPowerShell\profile.ps1:5 char:8
+ $Shell. <<<< WindowTitle="PowerShell obeys me!"
    + CategoryInfo          : InvalidOperation: (WindowTitle:String) [], RuntimeException
    + FullyQualifiedErrorId : PropertyNotFound    

now is i check my profile it tells me this:

$profile
d:\data\myusername\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1

but if i check this through windows explorer it tells me this:

d:\User\myusername\Documents\WindowsPowerShell\profile.ps1

Im confused here because within explorer tells me d:\Useres but PS shows it as d:\data...

How can i change this or force PS to look after d:\users instead of d:\data?

Upvotes: 1

Views: 1368

Answers (1)

Jackie
Jackie

Reputation: 2634

a tiny error: $Shell = $Host.UI.RawUI, and you may need to create the profile first by

 New-Item -Path $PROFILE -Type file

then edit it by

 notepad  $PROFILE

Upvotes: 1

Related Questions