/\/\o\/\/ PowerShelled

This blog has moved to http://ThePowerShellGuy.com Greetings /\/\o\/\/
$AtomFeed = ("Atom.xml")
$PreviousItems = (" Some more Windows PowerShell Links and info. "," Windows PowerShell (Monad / MSH) "," Simple port scanning using Monad "," Large AD queries in Monad "," Sharepoint provider for Monad "," access ADSI WinNT provider from Monad Part 2 "," MSH Community Workspace, TFSC provider and videos "," more Monad scripts, and a bit more CSV "," working with CSV files in MSH (part two) "," working with CSV files in MSH (part one) "," ")

Tuesday, April 25, 2006


Upgrading MSH, My first Windows PowerShell Commands

My first 3 Windows PowerShell Commands

PS G:\MOWSH> $host.version

Major Minor Build Revision
----- ----- ----- --------
1 0 9567 0

# let me run my scripts No Regedit !!

Set-ExecutionPolicy RemoteSigned

Move Profile to Documents and Settings\All Users\Documents\PSConfiguration\Microsoft.PowerShell_profile.ps1

# rename my scripts (otherwise my profile opens with notepad)

ls . *.msh -rec %| {rename-item $_.fullname ($_.name -replace ".msh",".ps1")}

now cleaning up, all the subscript calls in my profile ;-(

and ofcource the CMDlet name changes :

CMDLET RENAME: combine-path -> join-path
CMDLET RENAME: parse-path -> split-path
CMDLET RENAME: match-string -> select-string
CMDLET RENAME: time-expression -> measure-command
CMDLET RENAME: write-object -> write-output
CMDLET RENAME: All *-property cmdlets renamed to *-itemproperty: clear-itemproperty, copy-itemproperty, get-itemproperty, move-itemproperty, new-itemproperty, remove-itemproperty, set-itemproperty
CMDLET RENAME: trace-expression -> trace-command
CMDLET RENAME: invoke-command -> invoke-expression
CMDLET RENAME: Import-SecureString -> ConvertTo-SecureString
CMDLET RENAME: Export-SecureString -> ConvertFrom-SecureSring
CMDLET RENAME: Get-Provider -> Get-PSProvider
CMDLET RENAME: Get-drive -> Get-PSDrive
CMDLET RENAME: New-drive -> New-PSDrive
CMDLET RENAME: Remove-drive -> Remove-PSDrive

even my Custom Typeformatting has to be renamed

hmm, not a fun upgrade becouse of all that renaming, but tomorrow I will show some cool new tricks, and we will forget all those troubles.

b.t.w. a lot of older script on my blog will need a bit of fixing after this,
I will post updated versions of the bigger scripts later on.

gr /\/\o\/\/
Tags :

Anonymous Scott Hanselman
I understand this:

ls . *.msh -rec %| {rename-item $_.fullname ($_.name -replace ".msh",".ps1")}

but I was bummed that this didn't work:

ren *.msh *.ps1
Blogger /\/\o\/\/
Thanks for the Comment,
that was the first think I did look for also, but .

The -newpath parameter does not take Wildcards (the -path does say it does but does not also) , but you can also use a scriptblock like this :

ls . *.msh -rec | rename-item -newname {$_.name -replace ".msh",".ps1"} -WhatIf

as pointed out to by Bruce Payette in the NG, better as the foreach but still no ren *.msh *.ps1 ;-)

another hack wold be Use good old CMD LOL,

cmd /c 'ren *.foo *.bar'

gr /\/\o\/\/
Post a Comment

Links to this post:

Create a Link

<< Home


October 2005   November 2005   December 2005   January 2006   February 2006   March 2006   April 2006   May 2006   June 2006   July 2006   August 2006   September 2006   October 2006   November 2006   December 2006  

$Links = ("PowerShell RC1 Docs"," PowerShell RC1 X86"," PowerShell RC1 X64"," Monad GettingStarted guide"," Monad Progamming Guide"," Monad SDK"," Monad videos on Channel 9"," MSH Community Workspace"," scripts.readify.net "," MonadSource"," www.reskit.net"," PowerShell Blog"," Under The Stairs"," computerperformance powershell Home"," proudlyserving"," MSH on wikipedia"," MSHWiki Channel 9"," Keith Hill's Blog"," Precision Computing"," PowerShell for fun"," MSH Memo (Japanese)"," monadblog")

find-blog -about "PowerShell","Monad" | out-Technorati.
find-blog -contains "","" | out-Technorati.
Web mow001.blogspot.com

This page is powered by Blogger. Isn't yours?