Reply To: WinRM with non-domain joined machine using Certs
Here’s a draft of the process. It probably needs some polishing (and testing on clean systems, different operating systems / PowerShell versions, etc), but the basic content of what worked in my lab is...
View ArticleAdd Content formatting is wrapping the text.
I have a script that looks through an OU and lists all Security Groups, and the total members of each.Import-Module ActiveDirectory $groups = Get-ADGroup -f * -searchbase 'OU to search here' foreach...
View ArticleReply To: Add Content formatting is wrapping the text.
Its this line $strdone = ($group.name),’,',$membercountthat’s causing the problem. You need to concatenate the two strings so either use$strdone = ($group.name) + ‘,’ + $membercountOR $strdone =...
View ArticleReply To: Add Content formatting is wrapping the text.
Bah! /me has teh dumb!It was staring me in the face all morning! I was looking through my other scripts and they are all like your example$strdone = ($blah) +’,'+ ($blah1) and I completely overlooked...
View ArticleReply To: Add Content formatting is wrapping the text.
Okay I tried some changes suggested by others and came up with the following (99% not my code because a poster explained how to use $props via the example code below)$groups = Get-ADGroup -f *...
View ArticleReply To: Add Content formatting is wrapping the text.
Your logic isn’t identical in the script and manual stepsscript: InactiveCount=@($members|?{$_.lockedout -or $_.Enabled -eq $false}).countmanual: $i=($m|?{$_.lockedout -or $_.enabled -like...
View ArticleReply To: WinRM with non-domain joined machine using Certs
Just finished retesting on clean installations. Everything worked fine (no certificate errors with the User template). The only explanation I can think of is that maybe I copied and pasted the wrong...
View ArticleReply To: Comparing values of two cells from different xls files
Hi Rob! So sorry I couldn´t get back to you sooner but I had problems connecting to the forums at work. Anyways, thank you very much for your input! It really helped me out a lot! regards tchintchie
View Articleadding up values of a CSV column according to applied filter
Hello experts!I have two csv files with multiple columns each (only two which are of importance) and have filtered and grouped the MID column (Machine-ID). Now each MID has a corresponding GB Storage...
View ArticleReply To: Secure string vs. encrypted standard string
Great idea – I’ll Keep that in mind! And this technique might come in handy in other situations as well. Many thanks!
View ArticleReply To: Get-Host
If you’re talking about the Console and ISE, the versions will probably always match the PowerShell version. Developers can write their own custom hosts, though, which would have their own version...
View ArticleReply To: How to take specific words as objects from the text
You are pretty much on the right track with what you have. What is causing you a bit of a headache is those silly quote marks. If you change your first line to this$file = (Get-Content...
View ArticleReply To: How to take specific words as objects from the text
Oddly, I couldn’t find a ready-made generic tokenizer for .NET or PowerShell (which makes me want to write one soon). However, since your text file’s syntax basically matches a PowerShell command...
View ArticleReply To: Get-Host
In PowerShell 2.0 and above you can also use the $psversiontable variable which will give some additional interesting info such as wsman version and CLR version$psversiontable will give the powershell...
View ArticleReply To: Creating Tabbed Forms
Yes. Powershell uses Windows Forms, so you can always search something like “Windows Forms Tabs” and can emulate that in Powershell. Here is one...
View ArticleReply To: How to take specific words as objects from the text
This is also relatively easy to accomplish with a regex.$hosts = Get-Content .\hostfile.txt foreach ($computer in $hosts) { $computer -match '-host "(?<hostname>.*?)"' | Out-Null...
View ArticleReply To: How to take specific words as objects from the text
True, as long as the hostname is guaranteed to always have double quotes around it (though you could modify the regex to handle both cases).
View ArticleReply To: Get-Host
Thank you!So Get-Host will usually return the right value, but might be wrong in some Special cases. $psversiontable will fail on Powershell V1 but I found a great Workaround: # If the $PSVersionTable...
View ArticleReply To: Creating Tabbed Forms
SAPIEN’s own forums have a section for asking questions about GUIs, which you may find helpful. PrimalForms is an older product; the newer, non-free version is PowerShell Studio.
View Article