Jump to content

No Eject VMware VMs etc


NetworkPro

Recommended Posts

powershell as system:

Get-ItemProperty -Path 'hklm:\SYSTEM\CurrentControlSet\Enum\PCI\VEN_15AD*\*\' | Where {$_.Capabilities -eq '22'} | % {Set-ItemProperty -Path $_.PSPath -Name Capabilities -Value '18'}
Get-ItemProperty -Path 'hklm:\SYSTEM\CurrentControlSet\Enum\PCI\VEN_15AD*\*\' | Where {$_.Capabilities -eq '6'} | % {Set-ItemProperty -Path $_.PSPath -Name Capabilities -Value '2'}

 

Scheduled Task:

NoEjectVMWDevs.xml

<?xml version="1.0" encoding="UTF-16"?>
<Task version="1.4" xmlns="http://schemas.microsoft.com/windows/2004/02/mit/task">
  <RegistrationInfo>
    <Date>2018-07-30T07:26:44.4070731</Date>
    <Author>VMWARE\ADMIN</Author>
    <URI>\NoEjectVMWDev</URI>
  </RegistrationInfo>
  <Triggers>
    <BootTrigger>
      <Enabled>true</Enabled>
    </BootTrigger>
  </Triggers>
  <Principals>
    <Principal id="Author">
      <UserId>S-1-5-18</UserId>
      <RunLevel>HighestAvailable</RunLevel>
    </Principal>
  </Principals>
  <Settings>
    <MultipleInstancesPolicy>IgnoreNew</MultipleInstancesPolicy>
    <DisallowStartIfOnBatteries>false</DisallowStartIfOnBatteries>
    <StopIfGoingOnBatteries>true</StopIfGoingOnBatteries>
    <AllowHardTerminate>true</AllowHardTerminate>
    <StartWhenAvailable>false</StartWhenAvailable>
    <RunOnlyIfNetworkAvailable>false</RunOnlyIfNetworkAvailable>
    <IdleSettings>
      <StopOnIdleEnd>true</StopOnIdleEnd>
      <RestartOnIdle>false</RestartOnIdle>
    </IdleSettings>
    <AllowStartOnDemand>true</AllowStartOnDemand>
    <Enabled>true</Enabled>
    <Hidden>false</Hidden>
    <RunOnlyIfIdle>false</RunOnlyIfIdle>
    <DisallowStartOnRemoteAppSession>false</DisallowStartOnRemoteAppSession>
    <UseUnifiedSchedulingEngine>true</UseUnifiedSchedulingEngine>
    <WakeToRun>false</WakeToRun>
    <ExecutionTimeLimit>PT1H</ExecutionTimeLimit>
    <Priority>7</Priority>
  </Settings>
  <Actions Context="Author">
    <Exec>
      <Command>powershell.exe</Command>
      <Arguments>Get-ItemProperty -Path 'hklm:\SYSTEM\CurrentControlSet\Enum\PCI\VEN_15AD*\*\' | Where {$_.Capabilities -eq '22'} | % {Set-ItemProperty -Path $_.PSPath -Name Capabilities -Value '18'}</Arguments>
    </Exec>
    <Exec>
      <Command>powershell.exe</Command>
      <Arguments>Get-ItemProperty -Path 'hklm:\SYSTEM\CurrentControlSet\Enum\PCI\VEN_15AD*\*\' | Where {$_.Capabilities -eq '6'} | % {Set-ItemProperty -Path $_.PSPath -Name Capabilities -Value '2'}</Arguments>
    </Exec>
  </Actions>
</Task>

 

-

Link to comment
Share on other sites

  • 2 months later...

NoEjectVMWDevs.xml

<?xml version="1.0" encoding="UTF-16"?>
<Task version="1.4" xmlns="http://schemas.microsoft.com/windows/2004/02/mit/task">
  <RegistrationInfo>
    <Author>VMWARE\ADMIN</Author>
    <URI>\NoEjectVMWDev</URI>
  </RegistrationInfo>
  <Triggers>
    <BootTrigger>
      <Enabled>true</Enabled>
    </BootTrigger>
  </Triggers>
  <Principals>
    <Principal id="Author">
      <UserId>S-1-5-18</UserId>
      <RunLevel>HighestAvailable</RunLevel>
    </Principal>
  </Principals>
  <Settings>
  </Settings>
  <Actions Context="Author">
    <Exec>
      <Command>powershell.exe</Command>
      <Arguments>gp hklm:\S*M\C*t\E*m\*I\*\*\ -E ACP | Where {($_.Capabilities -band 0x4) -eq 0x4} | % {sp $_.PSPath Capabilities ($_.Capabilities -bxor 0x4)}</Arguments>
    </Exec>
  </Actions>
</Task>


 

-

Link to comment
Share on other sites

Create scheduled task from Admin CMD:

powershell "Register-ScheduledTask -Action (New-ScheduledTaskAction Powershell.exe 'gp hklm:\S*M\C*t\E*m\*I\*\*\ -E ACP | Where {($_.Capabilities -band 0x4) -eq 0x4} | % {sp $_.PSPath Capabilities ($_.Capabilities -bxor 0x4)}') -Trigger (New-ScheduledTaskTrigger -AtStartup) -TaskName NoEjectVMDev -User System"

 

Edited by NetworkPro

-

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.