
01.06.2009, 23:12
|
|
Banned
Регистрация: 12.07.2008
Сообщений: 206
Провел на форуме: 801258
Репутация:
33
|
|
Попробуй такую шнягу....
Option Explicit
On Error Resume Next
Dim objReg, objWMIService, objItem, colItems
Dim strComputer, strKeyPath, strValueName, strValue
Const HKEY_LOCAL_MACHINE = &H80000002
If WScript.Arguments.Count <> 1 Then
strComputer ="."
InputBox("Enter machine name you want to " &_"enable Remote Desktop", "Machine Name?", "")
If strComputer = "" Then
Call cleanUP
End If
Else
strComputer = WScript.Arguments(0)
End If
Set objReg=GetObject("winmgmts:{impersonationLevel=imp ersonate}!\\" &_
strComputer & "\root\default:StdRegProv")
If Err.Number <> 0 Then
Wscript.Echo Err.Number & " The remote machine (" & strComputer & ")" &_
" is unavailable or access denied."
Err.Clear
Call cleanUP
End If
strKeyPath = "SOFTWARE\Microsoft\Windows NT\CurrentVersion"
strValueName = "CurrentVersion"
objReg.GetStringValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,strValu e
If strValue >= 5.1 Then
strKeyPath = "SYSTEM\CurrentControlSet\Control\Terminal Server"
strValueName = "fDenyTSConnections"
objReg.GetDWORDValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,strValu e
If strValue = 0 Then
Wscript.Echo "Remote Desktop is already enabled on: " & strComputer
Call cleanUP
Else
strValue = 0
objReg.SetDWORDValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,strValu e
Wscript.Echo "Remote Desktop was enabled on: " & strComputer
Call cleanUP
End If
Else
Wscript.Echo "The remote machine (" & strComputer & ")" &_
"is not Windows XP or Windows 2003"
Call cleanUP
End If
Sub cleanUP
Set strComputer = Nothing
Set strKeyPath = Nothing
Set strValueName = Nothing
Set strValue = Nothing
Set stdOut = Nothing
Set objReg = Nothing
WScript.Quit
End Sub
|
|
|