Score:1

PowerShell script to write a printer name

mn flag

I have a PowerShell script. This:

Get-Printer | ft name,portname,location | Export-Csv c:\intel\intvprint2.csv -NoTypeInformation

But it isn't any good :( I made the script, but the result is file error data.

This it makes:

"ClassId2e4f51ef21dd47e99d3c952918aff9cd","pageHeaderEntry","pageFooterEntry","autosizeInfo","shapeInfo","groupingEntry"
"033ecb2bc07a4d43b5ef94ed5a35d280",,,,"Microsoft.PowerShell.Commands.Internal.Format.TableHeaderInfo",
"9e210fe47d09416682b841769c78b8a3",,,,,
"27c87ef9bbda4f709f6b4002fa4af63c",,,,,

But now see this:

Get-Printer | ft name,portname,location

name                          portname               location
----                          --------               --------
9620HP2055DN                  172.17.252.130         loc1
9590HP2055DN                  172.17.239.45          loc2

Why isn't the script good?

sn flag
Are you using [machine translation](https://en.wikipedia.org/wiki/Google_Translate)? The original was close to incomprehensible.
sn flag
(This question was on the [HNQ](https://meta.stackexchange.com/questions/40353/stack-exchange-glossary-dictionary-of-commonly-used-terms/40354#40354) today.)
sn flag
Here is [a list of aliases](https://pvm-professionalengineering.blogspot.com/2019/10/powershell-aliases-and-missing.html) in PowerShell (for a particular version). Alias 'ft' is for cmdlet *[Format-Table](https://docs.microsoft.com/en-us/powershell/module/Microsoft.PowerShell.Utility/Format-Table)*.
sn flag
What version of PowerShell?
Score:5
in flag

ft is an alias for Format-Table, which is meant to output the data pretty in a terminal. You want to use Select-Object (alias select) instead.

Get-Printer | select name,portname,location | Export-Csv c:\intel\intvprint2.csv -NoTypeInformation
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.