Forum Discussion
UPrint get ShareId in printer properties from Powershell
Hey there, I'm trying to apply permissions to 100 shared printers with Powershell but the none of the commands in the current module seem to have the ability to grab a shared printer's ShareId which is a requirement of the Grant-UPAccess command. I have to look them up tediously one by one in the portal and I may as well just add the groups by hand while I'm there if I'm doing that. Am I missing something or is that something coming in the future to the module perhaps?
Thanks
I can get the shareID like this:
Get-UPPrinter | select -ExpandProperty share | select sharename,shareid
Then I can share like this:
Grant-UPAccess -GroupId xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx-ShareID xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx
9 Replies
- KurtJcBrass Contributor
I can get the shareID like this:
Get-UPPrinter | select -ExpandProperty share | select sharename,shareid
Then I can share like this:
Grant-UPAccess -GroupId xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx-ShareID xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx
- Saurabh_Bansal
Microsoft
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
- NerradPBCopper Contributor
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_Bansal
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