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

Reply To: Help needed doing a find/replace on a group of text files

Adam and Mathieu, As far as I know the -match and -replace operators in PowerShell are case-insensitive. Below example works for me using a different set of test files of course. $TextFiles =...

View Article


Reply To: Help needed doing a find/replace on a group of text files

Nice ! Unlike the Replace method of string objects (used in the original script), the -replace operator is case-insensitive. This makes your solution simpler and shorter.

View Article


Sort Physical Disks by FriendlyName

Hi Folks, Sorry but the syntax for trying to do this has gotten the better of me tonight. I have some Azure disks I want to work on that I've retrieved like this: $uninitializedDisks =...

View Article

Reply To: Help needed doing a find/replace on a group of text files

I had tried used the -replace operator but that was probably 10 iterations of me trying ago. I'll try that again. However, I can tell you that -match is case-sensitive. It uses regex.

View Article

Reply To: Help needed doing a find/replace on a group of text files

Thanks for the $NewContent variable hint. Again, I was originally using all $Content but I get so frustrated sometimes I tend to just throw everything I can can think of at it. This was one of those...

View Article


Reply To: Sort Physical Disks by FriendlyName

If they all have PhysicalDisk at the front, can't a normal $UnitializedDisks | Sort work?

View Article

Reply To: Sort Physical Disks by FriendlyName

No, because "11" will sort before "2." A "plain" sort will only work if it's something like "PhysicalDisk01" and so forth. If that's not the case, I would probably do the Select-Object first, adding a...

View Article

PSremoting in Workgroup Environment

Here is my problem.. I have following parameters with me… - ComputerName of my remote system (Not the IP Address) - System is in Workgroup environment. - My host system is also in workgroup. - Both...

View Article


Reply To: PSremoting in Workgroup Environment

First, your Enter-PSSession command will also require a -Credential parameter. But meantime, the problem you're running into isn't PowerShell – it's basic networking. How can your computer resolve...

View Article


Reply To: Help needed doing a find/replace on a group of text files

I've done some testing and reading http://technet.microsoft.com/en-us/library/hh847759.aspx. The -match operator is case-insensitive as well. You can use the explicit case-insensitive operator -imatch...

View Article

Reply To: Help needed doing a find/replace on a group of text files

In my experiences you have to write to the file every single time you replace a value. The only way to avoid doing this is to create a file stream object that allows you to open the file for writing....

View Article

Reply To: Help needed doing a find/replace on a group of text files

Also found this blog post about doing it with Set-Content http://blogs.technet.com/b/heyscriptingguy/archive/2008/01/17/how-can-i-use-windows-powershell-to-replace-characters-in-a-text-file.aspx There...

View Article

Reply To: Help needed doing a find/replace on a group of text files

I really appreciate everyone's help. You guys got me over the hump! It ended up being a combination of 2 things; the case sensitivity issue and the fact that this is being run from a WinForm. What...

View Article


PSRemoting to Local 8.1 Hyper-v VM

I'm reading Don's new book Learn SQL Server Administration in a Month of Lunches and i set up my test VM. I'm running windows 8.1 and have hyper-v role installed. The vm is Server 2012r2. my laptop is...

View Article

Reply To: PSRemoting to Local 8.1 Hyper-v VM

First, SQL Server isn't really all that "manageable" via Remoting, because it isn't terribly well instrumented for PowerShell. If you're following the book, you won't find any PowerShell. You're...

View Article


Reply To: PSRemoting to Local 8.1 Hyper-v VM

ok thank you Don

View Article

Reply To: Just trying something

Thanks Martin

View Article


Reply To: Code Structuring, Functions and Layout

Don, Thanks for the advice and I got a copy of toolmaking so I am going through that now. Mathieu, thanks for your advice and efforts also. I will give those a try and let you know. The reason a...

View Article

Reply To: Just trying something

Let's take it step by step : $OU = (("CN=SPARE-LAPTOP,OU=Laptops,OU=Workstations,DC=domain,DC=local").TrimEnd(",DC=domain,DC=local") -split ",") This gives the following array of strings :...

View Article

Reply To: String wildcards

Since it's a non-Windows storage device, I doubt there are any easy ways of showing a list of shares. The easiest solution would be to create a new share on the parent folder and giving only a service...

View Article
Browsing all 13067 articles
Browse latest View live