/build/static/layout/Breadcrumb_cap_w.png

Don't be a Stranger!

Sign up today to participate, stay informed, earn points and establish a reputation for yourself!

Sign up! or login
Views: 3.6k  |  Created: 01/30/2007

Average Rating: 0
PowerShell has 3 inventory records, 83 Questions, 32 Blogs and 16 links. Please help add to this by sharing more!

Deployment Tips (1)

Most Common Setup Type
Not Determined
Average Package Difficulty Rating
Rated 4 / 5 (Somewhat Difficult) based on 1 ratings
Most Commonly Reported Deployment Method
Vendor Provided Command Line (switch driven)
4
Command Line
So the install is easy enough, typical /quiet /passive /norestart switches for a windows "update" package.

The devil here is in the details. By default the .ps1 file type is assigned to open in notepad, if you are like me and want to supplant VBScript then being able to double click the files (or run them easily from the command line) is vital.

#Install PS1.0 (requires .NET 2.0)
%INST%\WindowsXP-KB926139-v2-x86-ENU.exe /quiet /norestart

#Configure code signing, this allows anything NOT downloaded from the internet to run without being signed.
"C:\WINDOWS\system32\windowspowershell\v1.0\powershell.exe" Set-ExecutionPolicy RemoteSigned

#A word of warning, this only blocks files downloaded via an AES participant, like IE and Outlook Express. More details here: http://blogs.msdn.com/powershell/archive/2007/03/07/how-does-the-remotesigned-execution-policy-work.aspx

Now you can finish the job by running a .ps1 file itself. In order to do so you have to run it like so:

powershell.exe "&'C:\Path to script\script.ps1'"

It's annoying and dumb but that's what we are here to fix.

$ErrorActionPreference = "SilentlyContinue"

#Set Icon
#New-Item Registry::hkey_classes_root\microsoft.powershellscript.1\DefaultIcon
New-Item Registry::hkey_classes_root\microsoft.powershellscript.1\DefaultIcon -value ($PSHOME + '\powershell.exe,0')
#Set Association
New-Item Registry::hkey_classes_root\microsoft.powershellscript.1\shell
New-Item Registry::hkey_classes_root\microsoft.powershellscript.1\shell\open
New-Item Registry::hkey_classes_root\microsoft.powershellscript.1\shell\open\command -value ('"' + $PSHOME + '\powershell.exe" -command "& '%1'"')
#Remove Start Menu Shortcut
Remove-Item "C:\Documents and Settings\All Users\Start Menu\Programs\Windows PowerShell 1.0" -recurse

Now you should no longer have crappy text file icons for your .ps1 files, it will open the files when double clicked or run from the command prompt (still have to use full path names, it's a "feature" meant to make trojan attacks harder so, indicators are we will just have to live with it).

We've also deleted the Start Menu shortcut because if you, like me, are looking to roll this out to every machine in the company, we want it to be like VBScript...in other words, we don't even want the user to know or care that it's there.

One note here is that the icon change DOES take effect, but since I don't know what MS does to trigger a refresh, it wont show up till you reboot (or some other action comes along and kicks off a refresh).
Setup Information:
Setup Type: unspecified
Deployment Method Used: unspecified
Deployment Difficulty: unspecified
Platform(s): Windows

Inventory Records (3)

View inventory records anonymously contributed by opt-in users of the K1000 Systems Management Appliance.

PowerShell

Version

1.0.9567.0

Contact

Consult the Release Notes for support information.

Uninstall String

MsiExec.exe /X{2DFDD440-A33C-42E4-A366-71E6CB4246A0}

Questions & Answers (83)

Questions & Answers related to Microsoft PowerShell

2
ANSWERS
1
ANSWERS
1
ANSWERS
2
ANSWERED
2
ANSWERED
1
ANSWERS
1
ANSWERED
1
ANSWERS
1
ANSWERS
1
ANSWERS
3
ANSWERS
1
ANSWERED
2
ANSWERS
2
ANSWERS
1
ANSWERS
3
ANSWERED

Blogs (32)

Blog posts related to Microsoft PowerShell

blog
blog
blog
blog
blog
blog

Reviews (0)

Reviews related to Microsoft PowerShell

 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ