ML
    • Recent
    • Categories
    • Tags
    • Popular
    • Users
    • Groups
    • Register
    • Login

    Powershell Eject of USB Works how could I remount it without reconnecting the device

    IT Discussion
    eject powershell usb enable disable
    5
    13
    3.5k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • JaredBuschJ
      JaredBusch
      last edited by

      rescan from disk manager or disable and enable in disk manager work

      I would assume there are command line equivalents for that.

      DustinB3403D 1 Reply Last reply Reply Quote 2
      • DustinB3403D
        DustinB3403 @JaredBusch
        last edited by

        @jaredbusch yeah that is what I was just thinking about, just trying to figure out what the comparable is.

        1 Reply Last reply Reply Quote 0
        • DustinB3403D
          DustinB3403
          last edited by

          The issue is that as soon as the USB drive is removed, I'll have to rescan for all drives, select the correct one, by parsing through diskpart line by line like "list disk" | dispart hopefully find the correct one by randomly selecting it (disk 4, 5 6 etc) and then I could possibly remount it....

          dafyreD 1 Reply Last reply Reply Quote 0
          • dafyreD
            dafyre @DustinB3403
            last edited by

            @dustinb3403 said in Powershell Eject of USB Works how could I remount it without reconnecting the device:

            The issue is that as soon as the USB drive is removed, I'll have to rescan for all drives, select the correct one, by parsing through diskpart line by line like "list disk" | dispart hopefully find the correct one by randomly selecting it (disk 4, 5 6 etc) and then I could possibly remount it....

            If it should always be the same USB disk, can you get the disk label?

            So that before you eject the disk, get the label of the disk. Eject the disk, and then in 5 minutes do the rescan, and find which disk has that label?

            DustinB3403D 1 Reply Last reply Reply Quote 0
            • DustinB3403D
              DustinB3403 @dafyre
              last edited by

              @dafyre no, the label changes, week 1, week 2 etc.

              The reason for wanting for check in some duration (5m) is because apparently these people can't be bothered to actually swap the drive every week.

              So, eject the drive, and check in 5 if the disk uid is still around and reconnect

              travisdh1T 1 2 Replies Last reply Reply Quote 1
              • travisdh1T
                travisdh1 @DustinB3403
                last edited by

                @dustinb3403 said in Powershell Eject of USB Works how could I remount it without reconnecting the device:

                @dafyre no, the label changes, week 1, week 2 etc.

                The reason for wanting for check in some duration (5m) is because apparently these people can't be bothered to actually swap the drive every week.

                So, eject the drive, and check in 5 if the disk uid is still around and reconnect

                Every time, yep.

                1 Reply Last reply Reply Quote 0
                • 1
                  1337 @DustinB3403
                  last edited by 1337

                  @dustinb3403 said in Powershell Eject of USB Works how could I remount it without reconnecting the device:

                  @dafyre no, the label changes, week 1, week 2 etc.

                  The reason for wanting for check in some duration (5m) is because apparently these people can't be bothered to actually swap the drive every week.

                  So, eject the drive, and check in 5 if the disk uid is still around and reconnect

                  Perhaps use an usb hub and have more drives, say 5 or something. so you can swap more seldom.

                  Also have the machine beep and send emails / text reminder every hour until the drive has been swapped.

                  But if it's some kind of backup, why use usb drives at all?

                  DustinB3403D 1 Reply Last reply Reply Quote 0
                  • DustinB3403D
                    DustinB3403 @1337
                    last edited by

                    @pete-s said in Powershell Eject of USB Works how could I remount it without reconnecting the device:

                    But if it's some kind of backup, why use usb drives at all?

                    Because that is what this customer wants for these systems. I don't get it either

                    1 1 Reply Last reply Reply Quote 0
                    • 1
                      1337 @DustinB3403
                      last edited by 1337

                      @dustinb3403 said in Powershell Eject of USB Works how could I remount it without reconnecting the device:

                      @pete-s said in Powershell Eject of USB Works how could I remount it without reconnecting the device:

                      But if it's some kind of backup, why use usb drives at all?

                      Because that is what this customer wants for these systems. I don't get it either

                      OK, well I'd go for checking the disk label and send reminders until the correct drive is mounted. With some kind of escalation to their boss after X hours.

                      dafyreD 1 Reply Last reply Reply Quote 1
                      • dafyreD
                        dafyre @1337
                        last edited by

                        @pete-s said in Powershell Eject of USB Works how could I remount it without reconnecting the device:

                        @dustinb3403 said in Powershell Eject of USB Works how could I remount it without reconnecting the device:

                        @pete-s said in Powershell Eject of USB Works how could I remount it without reconnecting the device:

                        But if it's some kind of backup, why use usb drives at all?

                        Because that is what this customer wants for these systems. I don't get it either

                        OK, well I'd go for checking the disk label and send reminders until the correct drive is mounted. With some kind of escalation to their boss after X hours.

                        I'd be okay with this, although the End User may actually be annoyed at getting the "Change The Backup Drive, you Moron" emails and actually do it, lol.

                        1 Reply Last reply Reply Quote 0
                        • DustinB3403D
                          DustinB3403
                          last edited by

                          Okay so I've ended up going a different way with this, but I believe the results are the same.

                          This will disable the PNP device, based on the InstanceID

                          Disable-PnpDevice -InstanceID 'USB\VID_1B1C&PID_1A06\AA1TD4DI0B5WBKJG' -A

                          and this will enable the PNP Device

                          Enable-PnpDevice -InstanceID 'USB\VID_1B1C&PID_1A06\AA1TD4DI0B5WBKJG' -A

                          Also based on the InstanceID

                          While this isn't perfect (I need to know the instance ID of each USB device) it does make it simple to pull this detail from each device and build 1 or 2 scripts to do everything.

                          1 Reply Last reply Reply Quote 4
                          • DustinB3403D
                            DustinB3403
                            last edited by

                            Things to consider if you do this yourself, once you disable a device if you don't enable it again, it will remain disabled in device manager between subsequent removal/installation.

                            So it's critical to enable any disabled devices after the fact, or you'll have to manually enable the device through device manager.

                            1 Reply Last reply Reply Quote 0
                            • 1 / 1
                            • First post
                              Last post