If you are anything like me then you probably forget to lock your computer when you walk away from it, in the end I gave up and wrote a PowerShell script to do it for me......
####################################################
# Lock windows using an iPhone
#
# NBR : V 1.0.0 : 7/Jan/2013
#
####################################################
Function Register-SystemEvent
{
$query = "SELECT * FROM __InstanceDeletionEvent " +
"WITHIN 5 " +
"WHERE TargetInstance ISA 'Win32_PnPEntity' " +
"AND TargetInstance.Name = 'Apple iPhone' "
$null = Register-WmiEvent -Query $query -SourceIdentifier iPhoneLock -Action { c:\Windows\System32\rundll32.exe user32.dll,LockWorkStation }
}
Function main
{
Register-SystemEvent
}
main
Run the script on start up (or from a shortcut on your desktop - which is safer....), this registers the event with windows. Now unplug your iPhone before you walk away - simple really.
You could quite easily change the script to pick up any other type of phone, to get the TargetInstance.Name required try this (run it line by line)
You could quite easily change the script to pick up any other type of phone, to get the TargetInstance.Name required try this (run it line by line)
$data1 = gwmi Win32_USBControllerDevice |% { [wmi] $_.Dependent }
$data2= gwmi Win32_USBControllerDevice |% { [wmi] $_.Dependent }
Compare-Object $data1 $data2 -PassThru
My HTC HD returns the following (cut down)
Manufacturer : Compatible USB storage device
Name : USB Mass Storage Device
SystemCreationClassName : Win32_ComputerSystem
Caption : HTC Android Phone USB Device
ErrorCleared :
ErrorDescription :
HardwareID : {USBSTOR\DiskHTC_____Android_Phone___0100, USBSTOR\DiskHTC_____Android_Phone___, USBSTOR\DiskHTC_____, USBSTOR\HTC_____Android_Phone___0...}
Manufacturer : (Standard disk drives)
Name : HTC Android Phone USB Device
Manufacturer : HTC, Corporation
Name : My HTC
PNPDeviceID : USB\VID_0BB4&PID_0CA2&MI_01\7&323B5&0&23001
PowerManagementCapabilities :
PowerManagementSupported :
Service : HTCAND64
Status : OK
StatusInfo :
SystemCreationClassName : Win32_ComputerSystem
A few words of warning....
1. Microsoft don't really like people using "c:\Windows\System32\rundll32.exe user32.dll,LockWorkStation", there are other ways that you can do this
2. Don't put this in your start up folder without testing it.
3. I accept no responsibilities if you break anything :-)
And yes two phones, really
1. Microsoft don't really like people using "c:\Windows\System32\rundll32.exe user32.dll,LockWorkStation", there are other ways that you can do this
2. Don't put this in your start up folder without testing it.
3. I accept no responsibilities if you break anything :-)
And yes two phones, really