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

Add Char to string based on number.

What would be the best way to handle this?If I wanted to insert leading characters based on a length defined by a number. I would like to use in a PowerShell Script where I can do $value.length then...

View Article


Reply To: Add Char to string based on number.

$value = $value.PadLeft($field,”A”)

View Article


Reply To: Add Char to string based on number.

Strings have an Insert() method. Insert(2,”x”) would insert “x” at the 2nd position. You could also use the PadLeft() or PadRight() methods, which accept a desired string length and the length you’d...

View Article

Reply To: Add Char to string based on number.

PadLeft() is perfect for what I need. Thank you both.

View Article

Reply To: website issues

I’ve had that happen several times over the past few days. When it does, I found that I can get things working again by going to the “Edit My Profile” link, then back to the PowerShell.org main site...

View Article


Reply To: Best Practice Recommendation – Disk Space Report

In terms of “Best practices”, here’s what I would do differently:Don’t set $ErrorActionPreference to “SilentlyContinue”. Sweeping errors under the rug and not handling them is a bad habit. You don’t...

View Article

Generic PowerShell string tokenizer (work in progress, seeking opinions)

In this post, I went looking for a generic string tokenizer for .NET or PowerShell that would handle quoted tokens with embedded delimeters, escaped quotes, etc. I was surprised not to find one, so I’m...

View Article

Reply To: WinRM with non-domain joined machine using Certs

Dave,Re-tried this evening and it would seem I was making a mistake in the command and that it is NOT case sensitive. I can only assume a trailing space or something in notepad where I was manipulating...

View Article


Reply To: runspacepool hangs with more 30 WMI connectserver

Hello Sir,I am really impressed by your answers. It is a great lesson for me. Thank you. I understand better the need to adapt the same ThreadingModel between WMI and PS. Also,I naively transposed a...

View Article


Reply To: Add Char to string based on number.

I hadn’t used these methods before and was playing around with it. It doesn’t appear to work with spaces. Thoughts? PS C:\Windows\system32> $test = "TEST" PS C:\Windows\system32>...

View Article

Reply To: WinRM with non-domain joined machine using Certs

No problem! This might be useful for my company, as well. In some places, we use SSH with certificate authentication for this same type of scenario (scheduled tasks authenticating to workgroup...

View Article

Image may be NSFW.
Clik here to view.

Reply To: runspacepool hangs with more 30 WMI connectserver

No problem at all. Bonne chance!

View Article

Reply To: Add Char to string based on number.

I’m not sure what output you’re expecting to see, Rob. “This is a test” is longer than 10 characters, so the PadLeft method will just return the original string. If you increased the first argument to...

View Article


Image may be NSFW.
Clik here to view.

Reply To: Add Char to string based on number.

Ahhh, I get it now. I was thinking it was going to be 10 A’s appended to the front the string versus adding A’s for a total length of 10. Though the lightbulb may be dim, it’s on now. Thanks Dave....

View Article

Reply To: Generic PowerShell string tokenizer (work in progress, seeking...

Just noticed what the forums did to some of my quotation marks, and now I can’t edit it. The ugly stuff was supposed to look like this: Get-StringToken -Delimiter " `t" versus Get-StringToken...

View Article


Formatting testing

This is a line with embedded$string = "PowerShell code in a PRE tag.". Did it work?This is a line with embedded $string = "PowerShell code in a CODE tag.". Did it work?

View Article

Reply To: Generic PowerShell string tokenizer (work in progress, seeking...

Removed the attachment. I’ve made updates to the code, mainly learning to spell “Delimiter”. (Okay, actually there were more changes, including comment-based help, etc.)Rather than keeping an...

View Article


Winter Games 2013

So, there’s a POSSIBILITY we’ll hold a Winter Games in the last portion of this year, or the first portion of 2014.The format would be slightly different. You’ll still receive an event assignment, and...

View Article

Image may be NSFW.
Clik here to view.

Reply To: Winter Games 2013

I vote for late January (after the holidays, rather than before).I’d also be willing to help draft scenarios

View Article

Image may be NSFW.
Clik here to view.

Reply To: Winter Games 2013

Seems like a good plan. Differentiating from the Summer games adds a bit of variety and the collaborative aspects should make for some interesting results.A single track will work but I think we’ll...

View Article
Browsing all 13067 articles
Browse latest View live