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

Reply To: Mail-Enabled Nested Groups

hi, Good God, a nice challenge :-). If I understand you correctly, you have two issues. Speed and memory consumption when the script runs. Ideally you would like a script that runs fast without...

View Article


Reply To: Enable Basic Security

So, there’s a differences between the application-level encryption and the HTTPS channel. If the goal is to use Basic authentication, WinRM wants you to use HTTPS. That means you have to set up a...

View Article


Reply To: invoke-sqlcmd output to variable

When you use Invoke-sqlcmd what you get back is a collection of System.Data.DataRow You need to do something like this $tcpport = (Invoke-sqlcmd -ServerInstance “MyServer\MyInstance” -Query “select...

View Article

Reply To: invoke-sqlcmd output to variable

Thank you guys so much! the -expand did exactly what I needed! And I am taking the “distinct” advice as well.

View Article

Reply To: Excel automation (adding a table style)

Dave – you’re a gem! Got my script finished and it’s saving me soooooo much manual work! Cheers buddy – someone needs to create an ‘Add-Beer’ cmdlet.

View Article


Adding sequence number column to a result

Hi, I’m using the command below to get a list of some accounts on our Exchange Online: get-mailbox | ?{$_.ArchiveQuota -like "25*"} The result is: Name Alias ServerName ProhibitSendQuota —- —– ———-...

View Article

Reply To: Adding sequence number column to a result

Sure, that can be done. If you want to sort the output, though, you’ll wind up holding the entire result set in memory temporarily, which may cause an OutOfMemory error. Here’s a basic example of...

View Article

Reply To: Adding sequence number column to a result

I love this example Dave. Very very simple and much better than my old method of doing it.

View Article


Reply To: Adding sequence number column to a result

hi, I try to spread love and understanding about powershell anywhere and any time. Every time I start using Add-Member, people either love it(about 10%) or ask me if there is another way. In my bag of...

View Article


Reply To: Adding sequence number column to a result

The only reason I would choose that approach (several extra lines of code, not quite as easily read) is if it performed significantly better, and I wanted to optimize the code to perform well over a...

View Article

Reply To: Special characters being passed as parameter

I just wanted to followup on this in the off chance that it may help some one later. What I wound up doing was taking the string from the external process and using the DOS echo command to pipe it...

View Article

Image may be NSFW.
Clik here to view.

Reply To: Adding sequence number column to a result

yes, I know there is a performance hit. That was not the point. Sure, I have “several” extra lines of code, however my code example with the same select you have, is actually 36 characters less to...

View Article

Image may be NSFW.
Clik here to view.

Reply To: Adding sequence number column to a result

I didn’t use aliases or positional parameters in my example the way you did with Select-Object, and I also used PowerShell 2.0-compatible syntax. If character count matters, that line could be written...

View Article


C# code to powershell

I am currently trying to convert some c# code for the SCOM SDK to powershell, however I am struck on this line: IObjectReader<MonitoringObject> reader =...

View Article

Reply To: C# code to powershell

If I remember correctly, there’s currently no way to call generic methods from powershell. I’ll test it later today and see if I can get it working.

View Article


Reply To: C# code to powershell

Scratch that. http://stackoverflow.com/questions/18774889/how-do-i-call-a-parameterless-generic-method-from-powershell-v3 gives an example of how to accomplish this using Reflection: $nonGenericClass...

View Article

Reply To: Adding sequence number column to a result

Hi Dave, Thanks a lot for the fast reply. Worked like a charm! But there’s a big space on front of the columns, do you know why? PS C:\Office 365> get-mailbox | ?{$_.ArchiveQuota -like "50*"} |...

View Article


Reply To: Adding sequence number column to a result

You can add the -AutoSize switch when calling Format-Table to address that. Like sorting the list, this requires that the entire result set be temporarily held in memory, but since you’re already...

View Article

Reply To: Adding sequence number column to a result

Thanks once again! You’re the best =]

View Article

Reply To: C# code to powershell

Thank you Dave. I am looking into this. Cheers

View Article
Browsing all 13067 articles
Browse latest View live