lock do pc

paxa

Power Member
se não e a seccao indicada para o post peço desculpa

tenho andado a procura de uma maneira de fazer o lock do pc sem recorrer a software de terceiros, mas somente encontrei este script vbs
Código:
Option Explicit
On Error Resume Next

Const USAGELIMIT = 180
Const SHUTDOWNTYPE = 4

Dim WshShell, intRegVal, intTime, intDay
set WshShell = Wscript.CreateObject("WScript.Shell")

intTime = 0

intRegVal = WshShell.RegRead("HKCU\SessionInformation\ElapsedTime")
If Not Err.Number then
  intDay = WshShell.RegRead("HKCU\SessionInformation\LastDay")
  If Day(Now) <> CInt(intDay) then
    WshShell.RegDelete "HKCU\SessionInformation\ElapsedTime"
  Else
    intTime = intRegVal
  End If
End If

WshShell.RegWrite "HKCU\SessionInformation\LastDay", Day(now), "REG_SZ"

While intTime < USAGELIMIT
  WScript.Sleep 60000
  intTime = intTime + 1
  WshShell.RegWrite "HKCU\SessionInformation\ElapsedTime", intTime, "REG_SZ"
Wend

x = WshShell.Popup ("Your daily usage limit has been reached." & vbCrLf & "This system is shutting down. Please save " & vbCrLf & "all work in progress and log off. Any unsaved " & vbCrLf & "changes will be lost.", 60, "System Shutdown", 0 + 16)
ShutDown SHUTDOWNTYPE
WScript.Quit

Sub ShutDown(lintShutdownType) 
  Dim strComputer 
  Dim OpSys 
  Dim OpSysSet 
  strComputer = "." 
  
  If lintShutDownType = "" then 
    lintShutDownType = 4 
  End If 
  Set OpSysSet = GetObject("winmgmts:{(Debug,Shutdown)}//" & strComputer & "/root/cimv2").ExecQuery("select * from  Win32_OperatingSystem where Primary=true")
  For Each OpSys in OpSysSet 
    OpSys.win32Shutdown(lintShutdownType) 
  Next 
End Sub

somente tem de se abrir o notepad e colar isto lá guardar como *.vbs e meter em
[FONT=&quot]C:\Documents and Settings\utilizador\Start Menu\Programs\Startup\LimitUsage.vbs.
[/FONT]alterar o perfil de utilizador para limitado e o ficheiro em modo de leitura para o user q se pretende.
so que a chave HKCU\SessionInformation\ElapsedTime e a chave HKCU\SessionInformation\LastDay não existem, e parece me que as tenho que criar e para isso que tipo de dados é que posso meter na chave?
uma string?
alguem me pode ajudar com isto?
 
Back
Topo