/\/\o\/\/ PowerShelled

This blog has moved to http://ThePowerShellGuy.com Greetings /\/\o\/\/
$AtomFeed = ("Atom.xml")
$PreviousItems = (" MSH Minesweeper GUI game "," MSH get-WmiMethodHelp (GWM) Update + format tips. "," More on Cryptograpy and MSH "," Get-credential and Decrypting a SecureString in MS... "," Atari Laptop (no MSH content) "," Sending Mail from MSH "," MSH More replacement script update (HotFix) "," Enhanced More Function for MSH "," Get driveletters for All drives (Providers) in MSH... "," Math "," ")

Sunday, November 20, 2005

 


erroraction on new-item, my Wrong use of Stringbuilder



As I was in a small discussion about the use of the -errorAction Switch,
with NotBotherMeWithSpam,

I did think of a very useless and confusing use of it with new-item.

but as I think we where spaming the NG a bit already ;-),

I will post it here (below Sig).

as I type another error on my part came in on the NG,
my use of the stringbuilder class was wrong (I did use it to show where to use [VOID], but as you see below not with the stringbuilder ;-) )

you should use it like this :

$sb = $sb.append("newText")

so that would mean another edit to my script to generate "WMI method call" sample-scripts : MSH get-WmiMethodHelp (GWM) Update + format tips.

(I leave that up to you)

gr /\/\o\/\/


PS don't do this to your users !!

MSH>new-item -ea Inquire -type file testing.txt

Confirm
The file 'C:\Documents and Settings\mow\testing.txt' already exists.
[Y] Yes [A] Yes to All [H] Halt Command [S] Suspend [?] Help (default is "Y"): y
new-item : The file 'C:\Documents and Settings\mow\testing.txt' already exists.
At line:1 char:9
+ new-item <<<< -ea Inquire -type file testing.txt MSH>new-item -ea Inquire -type file testing.txt

Confirm
The file 'C:\Documents and Settings\mow\testing.txt' already exists.
[Y] Yes [A] Yes to All [H] Halt Command [S] Suspend [?] Help (default is "Y"): h
new-item : Command execution stopped because the user selected the Halt option.
At line:1 char:9
+ new-item <<<< -ea Inquire -type file testing.txt
MSH>


Comments: Post a Comment

Links to this post:

Create a Link



<< Home

Archives

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.
Google
 
Web mow001.blogspot.com

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