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 ArticleReply 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 ArticleReply 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 ArticleReply 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 ArticleReply 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 ArticleAdding 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 ArticleReply 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 ArticleReply 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 ArticleReply 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 ArticleReply 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 ArticleReply 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 ArticleReply 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 ArticleReply 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 ArticleC# 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 ArticleReply 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 ArticleReply 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 ArticleReply 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 ArticleReply 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 ArticleReply To: Adding sequence number column to a result
Thanks once again! You’re the best =]
View Article