Quantcast
Channel: PowerShell.org » All Posts
Browsing all 13067 articles
Browse latest View live

Try/Catch and ErrorAction

Hi there, Following some comments on our scorecard in the Scripting Games I’m not sure I understand how Try/Catch is applied in PowerShell. I thought any error a cmdlet generates would be caught and...

View Article


Reply To: Try/Catch and ErrorAction

Try/Catch will only intercept Terminating errors. Most errors from cmdlets are Non-Terminating, so if you want to handle them with Try/Catch, you need to set ErrorAction (or $ErrorActionPreference) to...

View Article


Reply To: Try/Catch and ErrorAction

Thanks for that. Considering your point about killing the pipe and forcing the Stop value, do you have any suggestions on when to use Try/Catch?

View Article

Reply To: Try/Catch and ErrorAction

Mainly when you’re running a command against a single input object, instead of passing in multiples (via the pipeline or an array). In that case, there’s no point in having any distinction between a...

View Article

Reply To: Hard coding values

Dunno, I guess they wanted the configuration to be loaded from a file or something. We got dinged for that too.

View Article


Is Desired State Configuration designed for the masses? How about scalability?

Hello! In the last time I have played heavily with Desired State Configuration. So there comes up some questions. The first Question is: How about scalability? Is Desired State Configuration designed...

View Article

Reply To: Is Desired State Configuration designed for the masses? How about...

Johan Akerstrom wrote o Facebook: 1. Use DSC with DFS or NLB for the DSC WebService 2. DSC has nested configurations. Use them. How you categorize your configurations with exceptions is your...

View Article

Reply To: Is Desired State Configuration designed for the masses? How about...

One thing to remember is that DSC is very much a 1.0 product. By that I mean that its the initial release. I expect future releases to build and expand on what we have now. In terms of scalability I...

View Article


Leaderboard

How are the scores on the Leaderboard being worked out? Is it supposed to be the average score over all of the events, or the average score of the events that the team entered? It looks like Aliens...

View Article


Reply To: Leaderboard

That’s a good point; I hadn’t noticed that. Before the judging of event 4 is complete, that should be fixed (or the final scores will be screwy.) Teams’ scores for each individual event should be...

View Article

Reply To: Leaderboard

At the moment, it’s an average of all scores across all events. Right now, all teams have (or will have) 2 sets of scores per event. However, the leaderboard is not assigning a zero to teams that...

View Article

Reply To: Leaderboard

I’ve updated the code. I want to keep looking at it as the final event 4 scores roll in this week. Right now, it is taking your cumulative score across all events and dividing by 8, which is the...

View Article

Image may be NSFW.
Clik here to view.

Reply To: Is Desired State Configuration designed for the masses? How about...

Hi Richard thank you for your Answer! Realy apreciate it! Yes I know it is a V.1.0 Product I discuss here me thougts before I make suggestion on MS Connect and perhaps the PowerShell Team read along...

View Article


Error Handling Discussion

Ed offers this example of using $ErrorActionPreference: Try { $ErrorActionPreference = "Stop" Copy-Item -Path $myfile -Destination $folder -Force } CATCH [System.Exception]{ MD $folder | Out-Null...

View Article

Variable in the file’s name filter.

Hello! I am new to PowerShell scripting your help will be really appreciated! The following works for me by running it as .ps1 script: $source=”C:\Backup\Full\” Get-ChildItem $source -Recurse -filter...

View Article


Reply To: Variable in the file’s name filter.

well, you’ve put “sclient” into the second example, whereas the first used “client”. But, you don’t need to concatenate: Get-ChildItem $source -Recurse -filter “aaa_bbb_$($client)_FULL.txt” Ought to...

View Article

Reply To: Variable in the file’s name filter.

Try Get-ChildItem $source -Recurse -filter “aaa_bbb_$client_FULL.txt” or Get-ChildItem $source -Recurse -filter (“aaa_bbb_” + $client + “_FULL.txt”) Filter expects a single string to define the filter...

View Article


Reply To: Variable in the file’s name filter.

Thank you so much for your help!!!! It worked. PS Sorry for typo

View Article

Reply To: Hard coding values

I wasn’t a judge on that event, but in general don’t take it as “you did something wrong.” A lot of the entries were VERY CLOSE, and so at some point judges have to get down to nitpicky style-related...

View Article

Reply To: Variable in the file’s name filter.

The following worked!!! Get-ChildItem $source -Recurse -filter “aaa_bbb_$($client)_FULL.txt”

View Article
Browsing all 13067 articles
Browse latest View live