Wednesday, September 04, 2013

Execute BGInfo when IP address changes

Updates IP on your BGInfo managed desktop background image when new network connection is detected. Notices also Cisco AnyConnect VPN connections. Import XML file with SchTasks.exe.



schtasks /F /Create /TN "DataSAAB IT, Autorun on Connect" /XML "C:\_DataSAAB_IT_\BGInfo\DataSAAB IT, BGInfo on Connect.xml"
<?xml version="1.0" encoding="UTF-16"?>
<Task version="1.2" xmlns="http://schemas.microsoft.com/windows/2004/02/mit/task">
  <RegistrationInfo>
    <Date>2011-11-11T11:11:11</Date>
    <Author>SYSTEM</Author>
  </RegistrationInfo>
  <Triggers>
    <EventTrigger>
      <ExecutionTimeLimit>PT30M</ExecutionTimeLimit>
      <Enabled>true</Enabled>
      <Subscription>&lt;QueryList&gt;&lt;Query Id="0" Path="Cisco AnyConnect Secure Mobility Client"&gt;&lt;Select Path="Cisco AnyConnect Secure Mobility Client"&gt;*[System[Provider[@Name='acvpncli'] and EventID=3020]]&lt;/Select&gt;&lt;/Query&gt;&lt;/QueryList&gt;</Subscription>
    </EventTrigger>
    <EventTrigger>
      <Enabled>true</Enabled>
      <Subscription>&lt;QueryList&gt;&lt;Query Id="0" Path="Cisco AnyConnect Secure Mobility Client"&gt;&lt;Select Path="Cisco AnyConnect Secure Mobility Client"&gt;*[System[Provider[@Name='acvpnui'] and EventID=3020]]&lt;/Select&gt;&lt;/Query&gt;&lt;/QueryList&gt;</Subscription>
    </EventTrigger>
    <EventTrigger>
      <Enabled>true</Enabled>
      <Subscription>&lt;QueryList&gt;&lt;Query Id="0" Path="Microsoft-Windows-NetworkProfile/Operational"&gt;&lt;Select Path="Microsoft-Windows-NetworkProfile/Operational"&gt;*[System[Provider[@Name='Microsoft-Windows-NetworkProfile'] and EventID=10000]]&lt;/Select&gt;&lt;/Query&gt;&lt;/QueryList&gt;</Subscription>
    </EventTrigger>
  </Triggers>
  <Principals>
    <Principal id="Author">
      <RunLevel>HighestAvailable</RunLevel>
      <UserId>S-1-5-18</UserId>
    </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>
    <WakeToRun>false</WakeToRun>
    <ExecutionTimeLimit>PT1H</ExecutionTimeLimit>
    <Priority>7</Priority>
  </Settings>
  <Actions Context="Author">
    <Exec>
      <Command>C:\_DataSAAB_IT\BGinfo\Bginfo.exe</Command>
      <Arguments>/accepteula "C:\_DataSAAB_IT\BGInfo\BGInfo.bgi" /timer:0 /ALL</Arguments>
    </Exec>
  </Actions>
</Task>

6 comments:

  1. Top post. Works a treat. Made my day.

    ReplyDelete
  2. Bloggers and substance supervisors utilize this office to modify content, all in view of statistic inclinations of online guests. Windows USA Arkansas

    ReplyDelete
  3. In reality VPN servers can be as quick as some other web associations in spite of the fact that there are a few things that you ought to do to have quicker VPN web speeds.
    what happens when you flush dns

    ReplyDelete
  4. Fearless and shocking in comparable measures, an undeniable necessity read.
    192.168.01.

    ReplyDelete
  5. Great survey, I'm sure you're getting a great response. Security cameras

    ReplyDelete
  6. /ALL argument only for Terminal servers, if you want update info on terminal servers. For me on workstations it wont work.
    I added 30s delay for triggers, because DHCP not so fast :)

    ReplyDelete

Got something to say?!