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>

 

Адрес на коментара
Сподели в други сайтове

  • 2 месеца по-късно ...

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>


 

Адрес на коментара
Сподели в други сайтове

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"

 

Редактирано от NetworkPro
Адрес на коментара
Сподели в други сайтове

Създайте нов акаунт или се впишете, за да коментирате

За да коментирате, трябва да имате регистрация

Създайте акаунт

Присъединете се към нашата общност. Регистрацията става бързо!

Регистрация на нов акаунт

Вход

Имате акаунт? Впишете се оттук.

Вписване
  • Потребители разглеждащи страницата   0 потребители

    • No registered users viewing this page.
×
×
  • Създай нов...

Important Information

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