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

Reply To: Need help with a broken ForEach

if (-not $sname) is never going to be True; $sname is a string you’ve defined. I assume you meant to do if (-not $svc) in that conditional.

View Article


Reply To: Workflow output,need help

on my way to work I was thinking only regular expressions can do it regex I hate it:) it worked like a champ thanks a lot for a quick reply to put me in the right direction now i’m going to do...

View Article


Reply To: IIS Log File Maintenance

hi, Maybe I am missing your point, however are you talking about how you should configure logfile rollover/retention so that it does not fill up your disk or are you talking about what IIS logs into...

View Article

Reply To: Workflow output,need help

The regex ‘^\s*|\s*$’ matches any amount of whitespace at the beginning or end of a string. Using that pattern with -replace (if a string variable is on the left of the -replace operator) is exactly...

View Article

Reply To: IIS Log File Maintenance

Log file management – e.g., rollover and archival. The end point was, no, IIS doesn’t do it natively, and yes, a custom DSC resource would deb a good way to go about it, if your servers have...

View Article


Reply To: IIS Log File Maintenance

Sorry, yes, roll-over and retention is indeed what I am after.

View Article

Reply To: Need help with a broken ForEach

***Pounds head on desk*** Can’t believe I did that. ($sname VS $svc) Is it kosher to ask why the try-catch-finally is only catching and logging one error? Do I have to do a ForEach for each error?...

View Article

Reply To: Need help with a broken ForEach

Well, you’ve suppressed the error by using -EA SilentlyContinue. You have to use -EA Stop to trigger Try/Catch. See our free ebook on error handling – under the “Resources” menu on the site.

View Article


Fabricating a custom -Filter in my Advanced Function

I have an Advanced Function that is designed to stream packets to me and they come into my NIC, similar to Wireshark. The problem is that I want to implement a -Filter parameter in my function rather...

View Article


Reply To: Fabricating a custom -Filter in my Advanced Function

So, I am completely not understanding what you’re asking. I think you probably need to share some code snippets of what you’re doing. As far as implementing your own -Filter parameter… that’s easy....

View Article

Reply To: Fabricating a custom -Filter in my Advanced Function

I doubt the performance will be any better than using Where-Object, but you can do something like this: function YourFunction { [CmdletBinding()] param ( [Parameter(ValueFromPipeline)] $InputObject,...

View Article

Reply To: Need help with a broken ForEach

Your try/catch block should probably be inside the foreach loop, not the other way around (unless you want the whole loop to abort as soon as an error occurs.)

View Article

Image may be NSFW.
Clik here to view.

Reply To: IIS Log File Maintenance

hi again, Don is almost correct We have rollover natively in IIS, however no achiving of items of an certain age. So custom DSC it is then or you could use a DSC script Resource while you develop you...

View Article


Reply To: Fabricating a custom -Filter in my Advanced Function

Never Mind. I tried an additional test and it succeeded. So the Fundamental question that I was asking has been solved. This is the test that I ran and succeeded with: Function Test {...

View Article

Reply To: Fabricating a custom -Filter in my Advanced Function

Get-ADUser’s filter is much more complex. It accepts a string, not a ScriptBlock, and it has code to parse that string and turn it into an LDAP filter behind the scenes. Writing your own code to parse...

View Article


Reply To: Workflow output,need help

Thanks again I just finished reading the “PowerTips Monthly Volume 6: Regular Expressions ” and understood it. although I was playing around with it and saw that even ‘^\s*’ seem to do the job(I guess...

View Article

Reply To: Fabricating a custom -Filter in my Advanced Function

I understand. I guess the bigger concern of mine is that trying to remember several different -filter syntax’s for different commands might be a little too much with their already high stress from a...

View Article


Reply To: Workflow output,need help

Your original approach is better. It’s poor practice to create an empty array, append to it, and return the whole array in one shot in a PowerShell function (though many people do it, for some...

View Article

Clone Required

Just when I thought I had my Summit sessions planned out, all sorts of new interesting titles are popping up from Microsoft. Clearly, I need to clone myself so I can attend everything at once. Anyone...

View Article

Reply To: Workflow output,need help

understood Thanks

View Article
Browsing all 13067 articles
Browse latest View live