Reply To: Another Empty Pipe Error when Export CSV used
You can’t pipe the result of a foreach loop to anything (which is different from the ForEach-Object cmdlet). There are a couple of ways you could change your code:Preferred method (not saving the...
View ArticleReply To: Another Empty Pipe Error when Export CSV used
Thanks for the response!I went with # Input Users from text file $USERS = Get-Content C:\inputfiles\USERS.txt #pipe variable through to get requisite information and export the information to csv...
View ArticleReply To: Another Empty Pipe Error when Export CSV used
Dave Wyatt wrote:You can’t pipe the result of a foreach loop to anything (which is different from the ForEach-Object cmdlet). There are a couple of ways you could change your code:I get those two...
View ArticleFunction output – results are correct, but format is strange
I have a (soon to be) advanced function that I am writing to gather some system information from various machines in our environment (name, os, service tag, disk, ram, etc).I am getting all of the data...
View ArticleReply To: Function output – results are correct, but format is strange
So, let’s look at a couple of things.First, consider changing your Get-WmiObject approach.$variable = Get-WmiObject ...Without the Out-Null is a lot more effective and easier to read. Performs better,...
View ArticleReply To: Sort running services
Wow Don let me say I got introduced to PS by watching your videos! You are great and am humbled by your response.I run the command and dont get what I necessarily need. I feel as if I over-complicated...
View ArticleReply To: Sort running services
Uh, I guess I’m confused.You want SERVICES or SCHEDULED TASKS? You started with Get-Service… that’s not for scheduled tasks.What’s shown in Task Manager is a list of PROCESSES… also different from...
View ArticleReply To: Sort running services
I guess I was after get-service because I thought the ID associated with them could somehow be tied to the process? I mentioned Task Manager because of the information it provides and was wondering if...
View ArticleReply To: Sort running services
Well.. okay. But you’re talking about different things.A service IS NOT a scheduled task. You don’t schedule services. They start automatically at boot, or can be started manually, or are completely...
View ArticleReply To: Function output – results are correct, but format is strange
Thanks for the response. I implemented the changes you suggested and I am seeing what I am looking for. I was confused initially because I had a similar script from the MVA Jumpstart series, and when I...
View ArticleLooping a function and outputting results to csv
I’m new to powershell and I’m now pushing the limits of ability with the following.I found the following method for creating a function to gather machine info. Now I’m looking to loop the function for...
View ArticleReply To: Looping a function and outputting results to csv
function Foo { $computers = 'one','two','three' foreach ($computer in $computers) { Get-MachineInfo $computer } } Foo | Export-CSV whatever.csv This’ll take a while for a long list, because the...
View ArticleReply To: Looping a function and outputting results to csv
Thanks so much, that worked brilliantly.
View ArticleReply To: Looping a function and outputting results to csv
I have a 2nd part now that I’ve just noticed. Can I find the OS as well. I’ve noticed that it’s part of a different WMI class but I’m not sure how I would include it. Can I just pipe the results of the...
View ArticleReply To: Looping a function and outputting results to csv
No, you can’t. Combining information from two places into a single output is more complex. If you want a usable CSV file, then you have to query the pieces you want, and then combine them into a...
View ArticleAutomate GPO settings
Hello All, I want to automate a task in Windows server 2008 R2 where we need to “Turnoff Event Shutdown Tracker”. This can be found in the path Gpedit.msc – >Computer Configuration...
View ArticleReply To: Automate GPO settings
The easiest way to do that across your domain is to use the GPO. if a GPO setting is already controlling it you won’t be able to change the registry key successfully – the GPO will re-apply.
View ArticleWant scenarios for practice.
Hi All,I am learning powershell and I want to be a scripting guy!. I am in basic level. wrote some scripts. Now I want your help to improve my knowledge in powershell scripting. I prefer to learn...
View ArticleReply To: Automate GPO settings
Hi Richard, Thanks for replying. How do we know that GPO setting is already controlling in my domain? Is there any other option to remove that control
View Article