Forum Discussion

NerradPB's avatar
NerradPB
Copper Contributor
Aug 27, 2020
Solved

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

  • NerradPB 

     

    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

  • KurtJc's avatar
    KurtJc
    Brass Contributor

    NerradPB 

     

    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

     

    • NerradPB's avatar
      NerradPB
      Copper Contributor

      KurtJc 

      Thanks mang, that worked a treat. I don't recall that option being available in the previous module update but I may have missed it. Cheers! 

       

    • NerradPB's avatar
      NerradPB
      Copper Contributor

      Saurabh_Bansal

       

      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's avatar
        Saurabh_Bansal
        Icon for Microsoft rankMicrosoft

        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

         

Resources