Quantcast
Channel: PowerShell.com – PowerShell Scripts, Tips, Forums, and Resources
Viewing all articles
Browse latest Browse all 6937

Output file name

$
0
0

I'm trying to read a file that is named "server44.txt" and output to a text file with the server name in it also:

 Select-String -Path C:\Folder\%computername%.txt -Pattern "Backup target: 1394/USB Disk labeled" >\\sandbox\c$\scripts\usb\%computername%.txt

I have hundreds of servers to run this on so I want the server name generic in the code. The file I'm reading from "server44.txt" is already on the servers. Each server has it's own name in the file like server44.txt does.

Pulling my hair out.

 

Thanks,

Ron


Viewing all articles
Browse latest Browse all 6937

Trending Articles