Lock-Workstation - Sebastian Gräf
post-template-default,single,single-post,postid-4257,single-format-standard,ajax_fade,page_not_loaded,,side_area_uncovered_from_content,qode-theme-ver-15.0,qode-theme-bridge,wpb-js-composer js-comp-ver-5.4.7,vc_responsive



You can do everything with PowerShell, yes as well locking your workstation with one simple function call. The function uses the API by importing the user32.dll and is being invoked to lock the workstation. Thanks to Mike Pfeiffer from TechNet for this simple but useful script. The fine thing is, it works on a local or remote session.

Function Lock-WorkStation
    #Requires -Version 2.0

    $sig = @" 
    [DllImport("user32.dll", SetLastError = true)] 
    public static extern bool LockWorkStation(); 

    $LockWorkStation = Add-Type -MemberDefinition $sig -Name "Win32LockWorkStation" -Namespace Win32Functions -Passthru 
    $LockWorkStation::LockWorkStation() | Out-Null 
No Comments

Sorry, the comment form is closed at this time.

%d bloggers like this: