header
header Register : : Login header
header
divider
menuleft
menuright
submenu
left

[August 25th, 2008] Check the home page regarding PowerShell related news from a brand new sponsor: Idera

$Profile
Last Post 12 Jun 2008 07:53 PM by smurawski. 2 Replies.
Printer Friendly
Sort:
PrevPrev NextNext
You are not authorized to post a reply.
Author Messages
dougUser is Offline
New Member
New Member
Posts:1
Avatar

--
12 Jun 2008 07:24 PM  

Do you happen to know how I can get around this problem:

My powershell "profile" location is determined by the $profile variable.  It seems to get set each time I open powershell
We have redirected desktop/homeshare... to network shares my location is \\seabird\doug$\\WindowsPowershell\microsoft.powershell_profile.ps1

it got the above by typeing $profile and pushing enter in ps.


when i put stuff in this file and open power shell i get a message saying "cannot be loaded because scripts is disabled on this system".

It says view get-help about_signing.  From what i can see it has to do with digital signing?  What it suggests is going to the file, rightclick, select properties and click unblock.  I don't have the unblock choice if i try this.

So it says you can sign it which seems interesting but I am not sure if I can /should do it.

The other thing i was thinking about is there a way to change where this thing looks for my profile information.  There is a variable used to find out what it is $profile.  I tried changing it but it seems to reset it each time you open powershell.

So i was wondering if you had any suggestions?  about changing where it looks or how to do signing.

Regards,

smurawskiUser is Offline
New Member
New Member
Posts:46

--
12 Jun 2008 07:48 PM  
Doug,

By default PowerShell is configured to allow command line access, but not run scripts. PowerShell profiles are scripts that run at the start of your PowerShell session.

The script signing information you are receiving is because the Execution Policy is set to Restricted, which does not load configuration files or run scripts. To verify this, you can run Get-ExecutionPolicy from the command line.

To update this setting, you can run Set-ExecutionPolicy and choose one of the other settings.
Possible values (from the help):
-- Restricted: Does not load configuration files or run scripts. "Restricted" is the default.
-- AllSigned: Requires that all scripts and configuration files be signed by a trusted publisher, including scripts that you write on the local computer.
-- RemoteSigned: Requires that all scripts and configuration files downloaded from the Internet be signed by a trusted publisher.
-- Unrestricted: Loads all configuration files and runs all scripts. If you run an unsigned script that was downloaded from the Internet, you are prompted for permission before it runs.

Example: Set-ExecutionPolicy RemoteSigned

I run with RemoteSigned privileges, which allows any scripts I have written to not need to be signed, but any remote scripts I would download to be signed.

As far as profile scripts go, there are some options as to where and which profile scripts you can modify.

There are (at least) four potential profile locations.
\WindowsPowerShell\Microsoft.PowerShell_profile.ps1.” - which is host specific profile for your current user account related to the powershell.exe host (your standard PowerShell install. This is the profile script $profile is associated with.

\WindowsPowerShell\profile.ps1.” - which is a profile that applies to all PowerShell hosts for your current user account (applies to PowerShell.exe and others, like PoshConsole - an open source host found on Codeplex, or PowerShell Plus, which is a free for non-commercial use)

\Microsoft.PowerShell_profile.ps1.” - which is a host specific profile for all users on a specific machine related to the powershell.exe host (your standard PowerShell install)

\profile.ps1.” - which is a machine specific profile for all hosts.

Other PowerShell hosts may have a specific profile script associated with them, and those can be located in different places, depending on the product.

Some of the profile scripts will not exist until you create them.
Steven Murawski
Co-Host - Mind of Root (www.mindofroot.com)
Host - PowerShell Basics (powershell-basics.com)
smurawskiUser is Offline
New Member
New Member
Posts:46

--
12 Jun 2008 07:53 PM  
It looks like some part of the file locations were stripped off.

The first two were in My Documents\rest of path, and the second two were in Powershell Installation Directory\rest of path.
Steven Murawski
Co-Host - Mind of Root (www.mindofroot.com)
Host - PowerShell Basics (powershell-basics.com)
You are not authorized to post a reply.

Active Forums 4.1
right
   
footer Sponsored by Quest Software • SAPIEN Technologies • ShellTools, LLC • Microsoft Windows Server 2008 footer
footer