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

Reply To: Turncated Issue on outfile

Out-File presents information basically exactly as it would show up at the console (including using the same console width, if I remember correctly.) If you want to allow really long lines in the...

View Article


Error handling through the pipeline

I was wondering if someone would be able to give me some tips on handling non terminating errors through the pipeline? Here is an example of what i would like to do. Get-ADUser -Filter {Enabled =...

View Article


Reply To: Turncated Issue on outfile

Dave, Thank you for the wealth of information. You are correct I will want to read the data back in after. So If I am understanding this correctly I should be changing this line to something else to...

View Article

Reply To: Error handling through the pipeline

You really need to move from a one liner into a more structured script. The pipeline is great for quick, linear tasks. But when logic (IF and error, THEN this) starts to get involved, you've moved out...

View Article

Reply To: Turncated Issue on outfile

Yep. Instead of Format-Table, you would use Select-Object, and then pipe the results to Export-Csv instead of Out-File. That would allow you to use Import-Csv on the file later (or to open it with...

View Article


Reply To: Error handling through the pipeline

Generally, to deal with non-terminating errors (where there's no expected terminating errors happening), I prefer to use the -ErrorVariable parameter. For example: Get-ADUser -Filter {Enabled =...

View Article

Reply To: Checking services remotely question

Watch out when using .contains it is case sensitive so if you was to put in 'tsm' instead of 'TSM' it would come back negative. Like is probably best because then you can do wildcard on TSM With...

View Article

Reply To: Error handling through the pipeline

Is there any specific advantage (say speed maybe) to doing this in a foreach loop or through the pipeline using the error variable? Is there a "best practice" or are both solution equally acceptable?...

View Article


Reply To: Error handling through the pipeline

If you're going to be processing multiple objects, dealing with them individually in a ForEach loop lets you handle errors individually, and then loop back to process the next object. Internally,...

View Article


Reply To: Error handling through the pipeline

There's also a bit of a balancing act between memory utilization and execution time. Using the pipeline allows you to stream objects and not have to store the entire result set in memory at any one...

View Article

Reply To: Powershell – group members & attribs for multiple groups...

I guess you could do this. I think you need to do abit more work with this really if you want to output the group name – perhaps put the details into a hashtable and then output that? $group =...

View Article

Reply To: Turncated Issue on outfile

Dave, Thank you for the code. I will take a look at this in 30 min or first thing tomorrow.

View Article

Reply To: Error handling through the pipeline

Thanks for the tips guys. I think I'll be using the ForEach loop.

View Article


Reply To: List Recipients w/o Exchange Unified Messaging Address

Hello Don, No worries at all. I appreciate the assistance. I had tried this previously after your advice to remove the second Select-Object condition, and it returns all other child properties of the...

View Article

Reply To: break a foreach loop, automatic variable woes

Thanks for the detailed explanation, Dave. For some reason I thought automatic variables would work in any kind of looping structure. I've never used the "Get-Things | foreach" construct. So I must've...

View Article


Reply To: break a foreach loop, automatic variable woes

Correct, and that's why you'll never see "| foreach" in a script that I write. When I'm using the cmdlet, I always spell out ForEach-Object with the capitalization, to make it easy to see the...

View Article

Different domain

Hi, I need to connect powershell remote to a computer(dc) in a diffident domain I write this: Enter-PSSession STUDENTSDC -Credential Get-Credential in the prom to cred i put domain.local\administrator...

View Article


Double hop problem?

Hello, I'm having some issues with what i think is a double-hop problem between servers in two different domains. On scorch1.test.local I do a "Enter-PSSession app1.corp.local -Credential...

View Article

Image may be NSFW.
Clik here to view.

Reply To: Double hop problem?

Problem found… I have forgotten two things 1. Setting up WSMAN as on page 41 of Secrets of PowerShell Remoting book found on this site also 2.. Enter-PSSession app1.corp.local -Credential...

View Article

Reply To: Different domain

There are a couple of possibilities here, based on what I can see. First of all, what are the names of the domain you're connecting from and to? Is "domain.local" the target domain? If domain.local is...

View Article
Browsing all 13067 articles
Browse latest View live