Forum Discussion
UPrint get ShareId in printer properties from Powershell
NerradPB Have you looked at the PowerShell documentation here - https://docs.microsoft.com/en-us/universal-print/fundamentals/universal-print-powershell?
You can get the same by trying the following sequence of commands:
> Connect-UPService
> $printers = Get-UPPrinter
> $printers[0].Share | Format-list
Hope this helps!
Thanks
Saurabh
Hi thanks for the reply, yes I've read through the documentation several times. Unless I'm really blind today (and often I am), Get-UpPrinter does not reveal the ShareId anywhere near as I can tell. It tells you IF it's shared, and what the share name is, but that's all.
That command doesn't seem to do anything for me. Returned no results.
- Saurabh_BansalAug 28, 2020
Microsoft
NerradPB Get-UPprinter returns "printers" object as a collection. Within the printer object, you will have "share" as object collection. Share object has ShareId, ShareName and CreatedDateTime as its properties.
Have you implemented all three commands in PowerShell that I listed above to see if it returns the ShareID?
> $printers = Get-UPPrinter
> $printers[0].Share[0].ShareID
Thanks,
Saurabh
- NerradPBAug 28, 2020Copper Contributor
Yes, as I mentioned in the previous reply.
"That command doesn't seem to do anything for me. Returned no results."
- Saurabh_BansalAug 28, 2020
Microsoft
NerradPB - the only reason I see that happening is when the printer is not shared. When you Get-UPPrinter, what does it say against printer's "IsShared" and "Share" properties?
Here is the output from what I run:
> $myprinter = Get-UPPrinter | where-object {$_.Name -eq "printer_shared"}
> $myprinter |Format-List
PrinterId : f10a7a74-a2a0-421a-97ff-258a68979d83
Name : printer_shared
Manufacturer : Test
Model : Test
RegisteredBy :
RegisteredDateTime : 8/28/2020 7:03:05 PM +00:00
Status : Microsoft.UPManagement.Models.PrinterStatus
Capabilities :
IsShared : True
Location : Microsoft.UPManagement.Models.PrinterLocation
Jobs :
Share : Microsoft.UPManagement.Models.PrinterShare
Connectors : {}>
If I run it for a printer that is not shared, here is what I get:
> $myprinter1 = Get-UPPrinter | where-object {$_.Name -eq "printer_not_shared"}
> $myprinter1 |Format-List
PrinterId : 5aa18aaa-93f7-4884-8919-c8ccded505ff
Name : printer_not_shared
Manufacturer : Test
Model : Test
RegisteredBy :
RegisteredDateTime : 8/28/2020 10:05:00 PM +00:00
Status : Microsoft.UPManagement.Models.PrinterStatus
Capabilities :
IsShared : False
Location : Microsoft.UPManagement.Models.PrinterLocation
Jobs :
Share :
Connectors : {}>
If you continue to face issues, I recommend reaching out to Support via https://portal.azure.com/#blade/Microsoft_Azure_Support/HelpAndSupportBlade/newsupportrequest