rasmi ranjan dash
rasmi ranjan dash

Reputation: 31

Any command to use in PowerShell to copy few lines from Console?

in my powershell script a lot of items are getting printed in the console. I want to copy them and validate a data is present or not. Any way I can do it?

I am yet to get any solution for this. thank you in advance

Upvotes: 1

Views: 94

Answers (4)

su7
su7

Reputation: 101

In your situation, i would use Start-Transcript into a log file.

And then get information from the log file using filters.

Upvotes: 1

rasmi ranjan dash
rasmi ranjan dash

Reputation: 31

I used $variable = command and it is working.

Upvotes: 2

Noctran
Noctran

Reputation: 21

One Way to record everything thats going on with your Script is Powershell Transcript

Or you can just Copy the Output from your Console to a Text file in Notepad++ or something like that...

But to be honest I don't quite understand what you are trying to achieve with that, wouldn't be the goal with a script that you don't have to check something like that?

My suggestion would be that you look for a way to validate anything you need within your Script, and maybe implement some sort of Logging to have the Option to review it when something has gone wrong...

Upvotes: 2

Dump Eldor
Dump Eldor

Reputation: 136

if your case is to validate your logs I suggest saving the logs into a file and then validating them and don't use the console for that purpose. if you still want to copy them from the console try this: Copy text from a Windows CMD window to clipboard

Upvotes: 1

Related Questions