
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-24-2009 06:36 PM
Is it possible to Start/Stop AD Active Scanning from the command line, or vbscript?
Thanks,
Jim Lovejoy
__________________________________________________________________________________________________
James W. Lovejoy | IBM - Cloud Managed Services Delivery | Infrastructure Architect (Windows Server ...
Solved! Go to Solution.
Labels:
- Labels:
-
General Discussion
1 ACCEPTED SOLUTION

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-25-2009 08:15 PM
This worked...Do you see any issues?
ScanMode(WScript.Arguments.Item(0))
Function ScanMode(Mode)
Dim ConWSH, strConnection, strSQL1, rs1, adOpenForwardOnly
Set ConWSH=WScript.CreateObject("ADODB.Connection")
strConnection = "Driver={SQL Server};Server=DBSERVER;Trusted_Connection=yes;Database=LansweeperDB;"
with ConWSH
.ConnectionString=strConnection
.ConnectionTimeout=25
.CommandTimeout=25
.Open
end with
strSQL1 = "Update tsysconfig Set activescanning='" & Mode & "'"
set rs1=createobject("ADODB.Recordset")
with rs1
.activeconnection=ConWSH
.CursorType=adOpenForwardOnly
.CursorLocation=3
.open strSQL1
End With
End Function
ScanMode(WScript.Arguments.Item(0))
Function ScanMode(Mode)
Dim ConWSH, strConnection, strSQL1, rs1, adOpenForwardOnly
Set ConWSH=WScript.CreateObject("ADODB.Connection")
strConnection = "Driver={SQL Server};Server=DBSERVER;Trusted_Connection=yes;Database=LansweeperDB;"
with ConWSH
.ConnectionString=strConnection
.ConnectionTimeout=25
.CommandTimeout=25
.Open
end with
strSQL1 = "Update tsysconfig Set activescanning='" & Mode & "'"
set rs1=createobject("ADODB.Recordset")
with rs1
.activeconnection=ConWSH
.CursorType=adOpenForwardOnly
.CursorLocation=3
.open strSQL1
End With
End Function
Thanks,
Jim Lovejoy
__________________________________________________________________________________________________
James W. Lovejoy | IBM - Cloud Managed Services Delivery | Infrastructure Architect (Windows Server ...
5 REPLIES 5

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-25-2009 09:05 PM
That's not an issue. I Will be stopping the local Lansweeper service, and remotely starting another one on a domain controller that can communicate to member servers that are outside of the primary network. I just needed a way to turn off Active Scanning, and turn it back on after the scans complete on those servers. This should do it until v4 comes out.
Thanks,
Jim Lovejoy
__________________________________________________________________________________________________
James W. Lovejoy | IBM - Cloud Managed Services Delivery | Infrastructure Architect (Windows Server ...

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-25-2009 08:56 PM
If it works ok, note that it might take 15 minutes to be active. (the service checks this value every 15 minutes)

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-25-2009 08:15 PM
This worked...Do you see any issues?
ScanMode(WScript.Arguments.Item(0))
Function ScanMode(Mode)
Dim ConWSH, strConnection, strSQL1, rs1, adOpenForwardOnly
Set ConWSH=WScript.CreateObject("ADODB.Connection")
strConnection = "Driver={SQL Server};Server=DBSERVER;Trusted_Connection=yes;Database=LansweeperDB;"
with ConWSH
.ConnectionString=strConnection
.ConnectionTimeout=25
.CommandTimeout=25
.Open
end with
strSQL1 = "Update tsysconfig Set activescanning='" & Mode & "'"
set rs1=createobject("ADODB.Recordset")
with rs1
.activeconnection=ConWSH
.CursorType=adOpenForwardOnly
.CursorLocation=3
.open strSQL1
End With
End Function
ScanMode(WScript.Arguments.Item(0))
Function ScanMode(Mode)
Dim ConWSH, strConnection, strSQL1, rs1, adOpenForwardOnly
Set ConWSH=WScript.CreateObject("ADODB.Connection")
strConnection = "Driver={SQL Server};Server=DBSERVER;Trusted_Connection=yes;Database=LansweeperDB;"
with ConWSH
.ConnectionString=strConnection
.ConnectionTimeout=25
.CommandTimeout=25
.Open
end with
strSQL1 = "Update tsysconfig Set activescanning='" & Mode & "'"
set rs1=createobject("ADODB.Recordset")
with rs1
.activeconnection=ConWSH
.CursorType=adOpenForwardOnly
.CursorLocation=3
.open strSQL1
End With
End Function
Thanks,
Jim Lovejoy
__________________________________________________________________________________________________
James W. Lovejoy | IBM - Cloud Managed Services Delivery | Infrastructure Architect (Windows Server ...

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-25-2009 07:12 PM
Does this look right? The usage would be .\ScanMode.vbs True or .\ScanMode.vbs False
WScript.Echo ScanMode(WScript.Arguments.Item(0))
Function ScanMode(Mode)
Option Explicit
Dim ConWSH, strConnection, strSQL1, Mode, rs1, adOpenForwardOnly
Set ConWSH=WScript.CreateObject("ADODB.Connection")
strConnection = "Driver={SQL Server};Server=DBSERVER;User ID=DOMAIN\USER;Password=pwd;Database=LansweeperDB;"
with ConWSH
.ConnectionString=strConnection
.ConnectionTimeout=25
.CommandTimeout=25
.Open
end with
strSQL1 = "Update tsysconfig Set activescanning='" & Mode & "'"
set rs1=createobject("ADODB.Recordset")
with rs1
.activeconnection=ConWSH
.CursorType=adOpenForwardOnly
.CursorLocation=3
.open strSQL1
End With
End Function
WScript.Echo ScanMode(WScript.Arguments.Item(0))
Function ScanMode(Mode)
Option Explicit
Dim ConWSH, strConnection, strSQL1, Mode, rs1, adOpenForwardOnly
Set ConWSH=WScript.CreateObject("ADODB.Connection")
strConnection = "Driver={SQL Server};Server=DBSERVER;User ID=DOMAIN\USER;Password=pwd;Database=LansweeperDB;"
with ConWSH
.ConnectionString=strConnection
.ConnectionTimeout=25
.CommandTimeout=25
.Open
end with
strSQL1 = "Update tsysconfig Set activescanning='" & Mode & "'"
set rs1=createobject("ADODB.Recordset")
with rs1
.activeconnection=ConWSH
.CursorType=adOpenForwardOnly
.CursorLocation=3
.open strSQL1
End With
End Function
Thanks,
Jim Lovejoy
__________________________________________________________________________________________________
James W. Lovejoy | IBM - Cloud Managed Services Delivery | Infrastructure Architect (Windows Server ...

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-24-2009 09:11 PM
You can directly access sqlserver from vbscript.
You need to change the "activescanning" field in table tsysconfig.
You need to change the "activescanning" field in table tsysconfig.
