I want to remove device specific device attached to my computer when i run a script in python but am not able to do this. Have searched on the web with no solution. link 1 and link 2
I learnt i can achieve that with power shell but am not able to achieve that.
This code is able to open the cd rom successfully
import os
os.system('powershell $driveEject = New-Object -comObject Shell.Application; $driveEject.Namespace(17).ParseName("""F:""").InvokeVerb("""Eject""")')
I came across this question how to remove printer from devices and printer which there is no answer for it.
I kindly need assistance achieve such result.

First I prepared a powershell script (s.ps1):
Then I created a Python script
After that I got an error in the log file
After reading the article I executed the commands in
cmdrunning under theadministratorAfter that, I was finally able to run the script. And I saw a pop-up in the tray with a message that I can eject the disk.