Removing Hidden Devices from VMs

I've been tasked with coming up with a script that will remove hidden devices from VMs. Anyone who's used VMs before knows that sometimes "ghost" devices show up. We've had a few problems recently and would like to write a script that will, on
startup, remove any of these hidden devices (yes, I'm fully aware some may be needed, we have logic that will not nuke them all).
Say I have an array that contains devices in WMI type format, let's call that list "$devices"
How would I remove each one using powershell? I've tried devcon, but I feel like I'm not getting the syntax right, my script is doing the following:
foreach ($device in $devices){
$toremove = $device.name
c:\windows\system32\devcon.exe remove $toremove
Is there a better tool than devcon, like maybe a PowerShell cmdlet (even one I have to download from somewhere)? If not, could someone help me get my syntax right (or tell me I need to use invoke- ?)
Thanks in advance.
[email protected]

Hi Zarberg,
I’m writing to just check in to see if the suggestions were helpful. If you need further help, please feel free to reply this post directly so we will be notified to follow it up.
If you have any feedback on our support, please click here.
Best Regards,
Anna Wang
TechNet Community Support
Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Support, contact [email protected]

Similar Messages

  • TS3989 My 5th gen ipod touch was stolen.  I removed the device from my iTunes account, but their pictures still show up on the photostream on the one I purchased to replace it.  How do I get this to stop, the cops have no interest in their faces, nor do I

    My 5th gen iPod touh was stolen a month ago.  I immediately removed that device from my account and yet today I looked at my photostream and there are tons of pics of these people on my photostream.  How do I get this to stop?!?

    Change your iCloud ID password: http://support.apple.com/kb/HT5624.  After doing so, go to Settings>iCloud, tap Delete Account, then sign back in with the new password.

  • I have lost my phone IMEI  Number 012546005322381, Serial Number 87******A4S, is there a way it can be tracked? Also, how can one remove the device from the itunes account

    I have lost my phone IMEI  Number 012546005322381, Serial Number 87******A4S, is there a way it can be tracked? Also, how can one remove the device from the itunes account
    <Serial Number Edited By Host>

    If you enabled Find my iPhone then you should use that. If not, I'm afraid you're out of luck for finding it. 
    To manage your devices, go to Your Account in iTunes.

  • How can I remove a device from my iCloud/Apple ID?

    Hi,
    I merged my dad's iphone to my Apple ID a while back because he wants to buy an app and I have some credit left over so I let him used my ID on his device. Apparently, all my contacts, pictures from photo stream, and ical are now also in his device. And all his contacts, pictures, and ical are on mines. How can I remove his device from my icloud and Apple ID WITHOUT deleting anything? Like I just don't want him to get anymore of my reminders and contacts, and pictures? Because I'm afraid taht if I remove his iphone on my icloud, all the pictures/contacts/ical that he took and went to my device too will be deleted because those are some important pictures/contacts/ical?
    I tried to manually delete some of my dad's contacts that was shared on my phone, it turns out that it got deleted on his phone as well and vice versa. How can I just completely cut him off of my icloud and ID without losing any of my and his contacts/pics/etc?

    Dr mizooo_1985 wrote:
    And i didn' erase anything,
    Hope her new BF is not a forensics expert .
      Can she see my icloud-backups???
    Not unless she knows your Apple ID/Password...or her new BF is good at forensics.
    What can i do to prevent icloud-backup to this pc???
    Same as my last answer...good luck.

  • How to remove a device from my plan

    I would like to remove a device from my Share Everything plan and lower my monthly bill.  How do I go about this?

    Its simple.  Verizon specifically does not want customers removing devices by themselves because they want to get you on the phone and try to talk you out of it.
    I actually stopped by a Verizon store to have my tablet taken off my plan, and the ONE person they have that is authorized to do terminations wasnt in the store so they couldnt do it.   
    I am a little annoyed to say the least.

  • A friend of mine uses my apple id. he's getting same imessages beeing sent to me. how can i remove his device from my account

    a friend of mine uses mi apple id. he's getting same imessages beeing sent to me. how can i remove his device from my account

    Using FaceTime http://support.apple.com/kb/ht4319http://support.apple.com/kb/ht4319
    Troubleshooting FaceTime http://support.apple.com/kb/TS3367http://support.apple.com/kb/TS3367
    The Complete Guide to FaceTime + iMessage: Setup, Use, and Troubleshooting
    http://tinyurl.com/a7odey8http://tinyurl.com/a7odey8
    Troubleshooting FaceTime and iMessage activation
    http://support.apple.com/kb/TS4268http://support.apple.com/kb/TS4268
    iOS: FaceTime is 'Unable to verify email because it is in use'
    http://support.apple.com/kb/TS3510http://support.apple.com/kb/TS3510
    Using FaceTime and iMessage behind a firewall
    http://support.apple.com/kb/HT4245http://support.apple.com/kb/HT4245
    iOS: About Messages
    http://support.apple.com/kb/HT3529http://support.apple.com/kb/HT3529
    Set up iMessage
    http://www.apple.com/ca/ios/messages/http://www.apple.com/ca/ios/messages/
    iOS and OS X: Link your phone number and Apple ID for use with FaceTime and iMessage
    http://support.apple.com/kb/HT5538http://support.apple.com/kb/HT5538
    How to Set Up & Use iMessage on iPhone, iPad, & iPod touch with iOS
    http://osxdaily.com/2011/10/18/set-up-imessage-on-iphone-ipad-ipod-touch-with-io s-5/http://osxdaily.com/2011/10/18/set-up-imessage-on-iphone-ipad-ipod-touch-with-io s-5/
    Set Up Alert Sounds
    http://www.quepublishing.com/articles/article.aspx?p=1873027&seqNum=3http://www.quepublishing.com/articles/article.aspx?p=1873027&seqNum=3
    Extra FaceTime IDs
    http://tinyurl.com/k683gr4http://tinyurl.com/k683gr4
    Troubleshooting Messages
    http://support.apple.com/kb/TS2755http://support.apple.com/kb/TS2755
    Troubleshooting iMessage Issues: Some Useful Tips You Should Try
    http://www.igeeksblog.com/troubleshooting-imessage-issues/http://www.igeeksblog.com/troubleshooting-imessage-issues/
    Setting Up Multiple iOS Devices for iMessage and Facetime
    http://macmost.com/setting-up-multiple-ios-devices-for-messages-and-facetime.htmhttp://macmost.com/setting-up-multiple-ios-devices-for-messages-and-facetime.htm l
    FaceTime and iMessage not accepting Apple ID password
    http://www.ilounge.com/index.php/articles/comments/facetime-and-imessage-not-acc epting-apple-id-password/http://www.ilounge.com/index.php/articles/comments/facetime-and-imessage-not-acc epting-apple-id-password/
    Fix Can’t Sign Into FaceTime or iMessage iOS 7
    http://ipadtutr.com/fix-login-facetime-imessage-ios-7/http://ipadtutr.com/fix-login-facetime-imessage-ios-7/
    FaceTime, Game Center, Messages: Troubleshooting sign in issues
    http://support.apple.com/kb/TS3970http://support.apple.com/kb/TS3970
    Unable to use FaceTime and iMessage with my apple ID
    https://discussions.apple.com/thread/4649373?tstart=90https://discussions.apple.com/thread/4649373?tstart=90
    How to Block Someone on FaceTime
    http://www.ehow.com/how_10033185_block-someone-facetime.htmlhttp://www.ehow.com/how_10033185_block-someone-facetime.html
    My Facetime Doesn't Ring
    https://discussions.apple.com/message/19087457#19087457https://discussions.apple.com/message/19087457#19087457
    How to watch FaceTime calls on the big screen with Apple TV
    http://www.imore.com/daily-tip-ios-5-airplay-mirroring-facetimehttp://www.imore.com/daily-tip-ios-5-airplay-mirroring-facetime
    Send an iMessage as a Text Message Instead with a Quick Tap & Hold
    http://osxdaily.com/2012/11/18/send-imessage-as-text-message/http://osxdaily.com/2012/11/18/send-imessage-as-text-message/
    To send messages to non-Apple devices, check out the TextFree app https://itunes.apple.com/us/app/text-free-textfree-sms-real/id399355755?mt=8https://itunes.apple.com/us/app/text-free-textfree-sms-real/id399355755?mt=8
    How to Send SMS from iPad
    http://www.iskysoft.com/apple-ipad/send-sms-from-ipad.htmlhttp://www.iskysoft.com/apple-ipad/send-sms-from-ipad.html
    How to Receive SMS Messages on an iPad
    http://yourbusiness.azcentral.com/receive-sms-messages-ipad-16776.htmlhttp://yourbusiness.azcentral.com/receive-sms-messages-ipad-16776.html
    You can check the status of the FaceTime/iMessage servers at this link.
    http://www.apple.com/support/systemstatus/http://www.apple.com/support/systemstatus/
     Cheers, Tom

  • How can i remove a device from itunes windows Vista

    how do i remove a device from itunes Windows Vista

    "Remove" it?
    You need do nothing.

  • How can i remove a device from my authorised devices on apple account?

    How can i remove a device from my authorised devices on apple account?

    Dr mizooo_1985 wrote:
    And i didn' erase anything,
    Hope her new BF is not a forensics expert .
      Can she see my icloud-backups???
    Not unless she knows your Apple ID/Password...or her new BF is good at forensics.
    What can i do to prevent icloud-backup to this pc???
    Same as my last answer...good luck.

  • How can i remove other device from my apple id?

    how can I remove my other device from my apple account?

    What to do before selling or giving away your iPhone, iPad, or iPod touch
    iCloud- Find My iPhone Activation Lock in iOS 7
    Find My iPhone Activation Lock- Removing a device from a previous owner’s account
    You will need to turn off Find My Phone the Restore it as New. You can do this remotely at your iTunes.com webpage.

  • How do I remove a device from my Apple ID and iMessage?

    I want to remove an iPod from my Apple ID but I'm not sure how

    Hey Daytona1,
    Thanks for the question. In regards to iMessage: You can remove your iOS device by following these steps:
    iOS and OS X: Link your phone number and Apple ID for use with FaceTime and iMessage
    http://support.apple.com/kb/HT5538
    How to unlink a phone number
    To remove a phone number from an Apple ID, sign out of FaceTime and Messages on your iPhone. Sign out in the following locations:
    - Settings > Messages > Send & Receive. Tap your Apple ID, then tap Sign Out.
    - Settings > FaceTime. Tap your Apple ID, then tap Sign Out.
    This should remove your phone number from other devices using the same Apple ID with FaceTime and Messages.
    If the phone number is still available on other devices after you sign out of FaceTime and iMessage on the iPhone, you may need to sign out of iMessage and FaceTime on all your devices, then sign in to FaceTime and Messages again on devices you want to use.
    Note: If you no longer have access to the iPhone that is using the number you want to remove, reset your Apple ID password.
    In regard to your iTunes Account/Apple ID: You can manage the devices that have been associated with your Apple ID (iTunes Account) from “View My Account”:
    Removing an associated device or computer from an Apple ID
    To remove a device or computer from your Apple ID:
    1. Open iTunes.
    2. Sign in to your Apple ID by choosing Store > Sign In from the iTunes menu.
    3. Choose Store > View My Account from the iTunes menu.
    4. From the Account Information screen, click Manage Devices.
    5. Click the Remove button next to the device name you would like to unassociate.
    Note: Removing a device from your Apple ID does not override the 90 day timer. The timer must complete 90 days from the day the device was associated before it can be associated to another Apple ID.
    iTunes Store: Associating a device or computer to your Apple ID
    http://support.apple.com/kb/HT4627
    Thanks,
    Matt M.

  • How do i remove a device from my apple id on find my phone app with out erasing the device.

    How do I remove a device from my apple id on the find my phone app with out erasing it becase it still belongs to my child?  I need to remove a iPad mini and a iPod 4th gen.
    Thanks

    If you haven't already, do Settings > iCloud and turn off Find My iPhone.  You will have to supply your Apple ID and password.
    Then do Settings > General > Reset > Erase All Content and Settings to make the iPhone appear as if it just came out of the box.

  • How to remove a device from my apple.ID

    I bought an iPad used and it was sent with a apple id and password   My wife changed both and now one week later it says the Beta OS is over and we must remove the device from the old apple id  to move to the new one.
    How do I remove a device from my apple id?

    This may help...
    iTunes Store: Associating a device or computer to your Apple ID

  • How can i see the "manage devices" in my itunes account? because i want to remove a device from using my apple id. tnx so much

    how can i see the "manage devices" in my itunes account? because i want to remove a device from using my apple id. tnx so much

    Thanks pvonk, I will try downloanding the book from the Iphone right now.......
    Just tried to download and it wants me to buy it again?  Is there some way around this?  I guess I thought that was the whole point of the cloud, buy it once and access from any of your devices right?
    Also, I have logged into the icloud.com as suggested and will plink around there for a bit and try to understand.  It is just all so dang different that what I am used to; Apple's way, that is.
    Thanks again for the Icloud tip and if you know of a way to download without making a 2nd purchase I would sure love to hear it!
    Geez. one other thing (I guess I am complaining) but I bought more space in the cloud, they took my cash fast enough but have not yet increase the size of my storage space yet?  Is Apple sometimes slow to get internal stuff done?

  • How do I remove a device from my iCloud account?

    Hi, my daughters iphone is connected to my icloud account.
    How do I remove her device from that account?
    Thanks.

    If you mean that she is sharing your iCloud account and you want to migrate her phone to a separate account, start by saving any photo stream photos she wants to keep on her phone to her camera roll (unless already there) by opening her my photo stream album, tapping Select, tap the photos, tap the share icon -- box with upward pointing arrow, then tap Save to Camera Roll.  If she is syncing notes with iCloud, you will need to open each one and email them to her so she can later copy and paste the text into new notes created in her new account.  Then go to Settings>iCloud, tap Delete Account (which only deletes it from her phone, not from iCloud; your device will not be effected by this), choose Keep on My iDevice and provide the password to turn off Find My iPhone.  Then sign back in with a different Apple ID to create her new account and choose Merge to upload her data.
    Once your devices are on different accounts you can each go to icloud.com from your computer and delete the other person's data from your account.

  • Error message: "Remove USB Device from printer."

    I have an HP Photosmart 309 a All-In-One.  It is attached to my desktop computer, which utilizes the Windows XP system. I've owned the All-In-One for about three years. I do not use the All-In-One -- or this computer -- very much. (I mostly use my laptop.)
    I have not made any changes to this computer and/or All-In-One in quite some time. This error message is new. I do not have a USB device attached to the printer.  Even with the error message displayed, the All-In-One allows me to print, but it will not allow me to make a copy or scan.  How do I make this error message go away?  What's wrong with my All-In-One?  Thank you for your help!

    Hi DuckLakeSue,
    I understand that you are getting an error message to 'Remove USB Device from printer'. Follow the steps provided in this link by the PrintDoc to determine if your wireless radio has failed.
    I hope this helped, let me know.
    Thank you,
    I worked on behalf of HP.

Maybe you are looking for