Quantcast
Channel: The Official Scripting Guys Forum! forum
Viewing all articles
Browse latest Browse all 15028

Script to retrieve PC name and all Printers attached then output to txt file.

$
0
0

Sorry I am new to PowerShell and learning as I go.   I want to use the get-content, and get-printer to output the name of a pc and all printers attached then write the information to a txt file.   However I will be pushing this out in sccm so I want the script not to overwrite any previous entries or make copies.   The script would write new lines to a txt file listing pc names and attached printers.  Ideally I want to push out the script overnight and hopefully in the morning I have a nice txt file with my network PC names and connected printers all in one txt file.   Bellow is what i have came up so far but obviously not working or doing what i would like it to do. 

$computer = gc env:computername
Get-content env:computername
Get-Printer
Get-Printer | Get-Content | Out-File \\network path of .txt file location


Technology should not be a problem but a solution. 



Viewing all articles
Browse latest Browse all 15028

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>