1 2 3 4 |
$signature = '[DllImport("user32.dll",SetLastError=true)] public static extern bool LockWorkStation();' $t = Add-Type -memberDefinition $signature -name api -namespace stuff -passthru $null = $t::LockWorkStation() |
Fuente: https://community.idera.com/database-tools/powershell/powertips/b/tips/posts/locking-workstation-1