博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
vb ad i脚本
阅读量:5260 次
发布时间:2019-06-14

本文共 3283 字,大约阅读时间需要 10 分钟。

获取ip

strComputer = "."

Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set IPConfigSet = objWMIService.ExecQuery("Select IPAddress from Win32_NetworkAdapterConfiguration ")
DIP = ""
dim x
dim IPAddr(255)
x = 0
For Each IPConfig in IPConfigSet
If Not IsNull(IPConfig.IPAddress) Then
For i=LBound(IPConfig.IPAddress) to UBound(IPConfig.IPAddress)
If Not (IPConfig.IPAddress(i)="0.0.0.0") Then
IPAddr(x) = IPConfig.IPAddress(i)
x = x + 1
End if
Next
end if
next
' msgbox "First IP is: " & IPAddr(0)
' if more IP's exist, they will be in IPAddr(1), IPAddr(2) and so on
'Session.Property("EDIT_WCFIP")=IPAddr(0)
Session.Property("ODBC_RES_PROP")=IPAddr(0)

验证连接:

Session.Property("validate_sqlconn") = "1" '先让验证通过

Session.Property("TXT_SQL_ERR") = "" '清空验证信息

Dim objConnection

Set objConnection = CreateObject("ADODB.CONNECTION")

dim connStrParam

connStrParam = Session.Property("EDIT_CONNSTR")

Dim connStr

connStr = "provider=sqloledb;Initial Catalog=master;" & connStrParam

on error resume next

objConnection.Open connStr
If Err.Number <> 0 Then
Session.Property("validate_sqlconn") = "0"
Session.Property("TXT_SQL_ERR") = "连接失败!"& Err.Description
Err.Clear
ELSE
If (objConnection.State <> 1) Then
Session.Property("validate_sqlconn") = "0"
Session.Property("TXT_SQL_ERR") = "连接失败!未知错误。"
else
dim overwrite
if (Session.Property("CHK_DB_OVERWRITE") = "CheckBox") then
Session.Property("CHK_Exist_Exam") = "100"
Session.Property("CHK_Exist_Training") = "100"
Session.Property("CHK_Exist_Structure") = "100"
Session.Property("CHK_Exist_Resource") = "100"
'msgbox "123"
else
'msgbox "1234"
Dim objRecordSet
Set objRecordSet = CreateObject("ADODB.RECORDSET")

Dim objCommand

Set objCommand = CreateObject("ADODB.COMMAND")
objCommand.ActiveConnection = objConnection

objCommand.CommandText = "select * from sysdatabases where name='" & Session.Property("DB_Name_Exam") & "'"

objRecordSet.CursorLocation = 3
objRecordSet.Open objCommand
dim count1
count1 = objRecordSet.RecordCount
if (count1 > 0) then
Session.Property("CHK_Exist_Exam") = "1"
else
Session.Property("CHK_Exist_Exam") = "100"
END IF
objRecordSet.close

Set objCommand = Nothing

Set objRecordSet = Nothing
end if
End If
set objConnection = Nothing
end if
'msgbox Session.Property("EDIT_Server")

 检测端口:

Session.Property("validate_webport") = "1" '先让验证通过

Session.Property("TXT_WEBPORT_ERR") = "" '清空验证信息

dim port

port = Session.Property("EDIT_WEBPORT")
'msgbox port
if(port = "") THEN
Session.Property("validate_webport") = "0"
Session.Property("TXT_WEBPORT_ERR") = "端口号不能为空!"
elseif(port <= 0) THEN
Session.Property("validate_webport") = "0"
Session.Property("TXT_WEBPORT_ERR") = "无效的端口号!"
else
Set WshShell = CreateObject("WScript.Shell")
Set oExec = WshShell.Exec("netstat -an")
Set oStdOut = oExec.StdOut
Do Until oStdOut.AtEndOfStream
strLine = oStdOut.ReadLine
If InStr(strLine, ":" & port) > 0 And InStrRev(strLine, "ESTABLISHED") > 0 Then
Session.Property("validate_webport") = "0"
Session.Property("TXT_WEBPORT_ERR") = "端口已被占用!"
Exit Do
End If
Loop
End If

删除目录:

set fso=createobject("scripting.filesystemobject")

on error resume next
dim tar
tar = Session.Property("APPDIR")
msgbox tar
set sfold = fso.getfolder(tar)
sfold.attributes=0
sfold.delete

转载于:https://www.cnblogs.com/Junger/p/7767482.html

你可能感兴趣的文章
mysql数据库数据乱码解决方案
查看>>
Laravel 安装predis 扩展
查看>>
P5241 序列
查看>>
P3538 [POI2012]OKR-A Horrible Poem
查看>>
Java Web中web.xml文件简单介绍
查看>>
实验报告2
查看>>
关于函数柯里化
查看>>
poj 2686 Traveling by Stagecoach
查看>>
为html设置100%,body 设置100% 出现滚动条的问题
查看>>
linux下WPS的使用
查看>>
java 中 finally里面写了return 会发生什么?
查看>>
Web Api 利用 cors 实现跨域
查看>>
hdu 3938 并查集
查看>>
谈谈hashcode和equals的用法
查看>>
instanceof
查看>>
BZOJ 题目1036: [ZJOI2008]树的统计Count(Link Cut Tree,改动点权求两个最大值和最大值)...
查看>>
《深入分析Java Web技术内幕》读书笔记之JVM内存管理
查看>>
python之GIL release (I/O open(file) socket time.sleep)
查看>>
Excellent Strategies to Expand Clients
查看>>
【原创】Django-ORM基础
查看>>