function act1(no)
{
if(document.all.item(“y”+no).style.display==””) document.all.item(“y”+no).style.display=”none”;
else document.all.item(“y”+no).style.display=””;
}
1、在 Windows 或 AD 中批量增加用户
使用方法,新建一 users.csv,字段格式必须按如下顺序,且不能为空: 登录名, 姓名, 密码, 描述;然后将脚本与 CSV 文件存储至同一目录,以管理员/域管理员运行脚本即可。
代码>> (单击显示/隐藏)
'// Name: BulkAddUser
'// Purpose: 从 CSV 文件中批量生成 Active Directory 用户
![]()
'// 注意:
'// 1. 源文件必须使用逗号分割
'// 2. 字段必须按如下顺序,且不能为空: 登录名, 姓名, 密码, 描述
'// 3. 只能由域管理员才能运行此程序
![]()
Option Explicit
![]()
Dim oFSO, oTF, objRootDSE, objContainer, i
Dim aLine, sLine, sLogon, sPass
Dim sLoginName, sDisplayName, sDescription
![]()
![]()
'// 用户批量文件
Const InpFile = "users.csv"
Const ForReading = 1
![]()
Set oFSO = CreateObject("Scripting.FileSystemObject")
Set oTF = oFSO.OpenTextFile(InpFile, ForReading, True)
![]()
Set objRootDSE = GetObject("LDAP://rootDSE")
Set objContainer = GetObject("LDAP://cn=Users," & objRootDSE.Get("defaultNamingContext"))
![]()
i = 1
Do While oTF.AtEndOfStream <> True
sLine = oTF.ReadLine
aLine = Split(sLine, ",", -1, 1)
sLoginName = aLine(0)
sDisplayName = aLine(1)
sPass = aLine(2)
sDescription = aLine(3)
![]()
If IsEmpty(sLoginName) Or IsEmpty(sDisplayName) Then
MsgBox "第 " & i & " 行数据有误:登录名和姓名不能为空", vbExclamation, "Add Bulk Users"
End If
![]()
Set objLeaf = objContainer.Create("User", "cn=" & sLoginName)
objLeaf.Put "sAMAccountName", LCase(sLoginName)
objLeaf.Put "givenName", Left(sDisplayName, 1)
objLeaf.Put "sn", Mid(sDisplayName, 2)
objLeaf.Put "UserPrincipalName", LCase(sLogon)
objLeaf.Put "DisplayName", sDisplayName
objLeaf.Put "description", sDescription
![]()
objLeaf.SetInfo
![]()
'// 是否重复
If Err.Number = -2147019886 Then
MsgBox "User logon for " & sLogon & " already exists.", vbExclamation, "Bulk Add Users"
Else
'// Set initial password
objLeaf.setpassword sPass
objLeaf.AccountDisabled = False
objLeaf.SetInfo
End If
i = i + 1
Loop
![]()
MsgBox "用户创建完毕.", vbInformation, "Bulk Add Users"
Set oTF = Nothing
Set oFSO = Nothing
2、清理 IIS Log 中的非重要信息(如 XML、JS、JPG、GIF等资源的访问日志),只留下 asp 和 aspx 的访问日志。经我在一台服务器上测试,日志文件由 6G 变为 900M ,大大节省了空间。
使用方法:保存代码至 .vbs 文件,确认其中关于 IIS 日志路径是否正确,然后运行即可。
代码>> (单击显示/隐藏)
<span id=y2 style="DISPLAY: none" color="#0000ff" face="Courier New"
Const ForReading = 1
Const ForWriting = 2
![]()
Dim tempLine,curDir,objFolder,objFSO,objFiles,objFile,f
![]()
curDir = "C:\Windows\System32\LogFiles\"
![]()
![]()
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFolder = objFSO.GetFolder(curDir)
Set objFiles = objFolder.Files
![]()
For Each f in objFiles
If Instr(f.Name,"ex0") > 0 Then
Set objFile = objFSO.OpenTextFile(curDir + f.Name, ForReading)
Set objFile1 = objFSO.OpenTextFile(curDir + Replace(f.Name,"ex0","bk0"), ForWriting, True)
![]()
![]()
Do Until objFile.AtEndOfStream
tempLine = objFile.ReadLine
If Instr(tempLine,".asp - 80") > 0 OR Instr(tempLine,".aspx - 80") > 0 Then
objFile1.WriteLine tempLine
End If
Loop
![]()
objFile.Close
objFile1.Close
End If
Next
![]()
Msgbox "日志文件清理完毕"
1、批量添加用户批处理版:
for /f "tokens=1,2 delims=" %%i in (user_pwd.txt) do net user %%i %%j /add /any_other_options_you_want
for /f "tokens=1 delims=" %%i in (user_pwd.txt) do net group groupname %%i /add
2、清理日志
用find或findstr的-v开关过滤就好
按太快….
请问 sql server 如何清理日志?
不是很明白,學習
在 Windows 或 AD 中批量增加用户
版主,这个脚本错误,用不了!
1、批量添加用户批处理版:
for /f "tokens=1,2 delims=" %%i in (user_pwd.txt) do net user %%i %%j /add /any_other_options_you_want
for /f "tokens=1 delims=" %%i in (user_pwd.txt) do net group groupname %%i /add
2、清理日志
用find或findstr的-v开关过滤就好
1、在 Windows 或 AD 中批量增加用户
使用方法,新建一 users.csv,字段格式必须按如下顺序,且不能为空: 登录名, 姓名, 密码, 描述;然后将脚本与 CSV 文件存储至同一目录,以管理员/域管理员运行脚本即可。
代码>> (单击显示/隐藏)
‘// Name: BulkAddUser
‘// Purpose: 从 CSV 文件中批量生成 Active Directory 用户
‘// 注意:
‘// 1. 源文件必须使用逗号分割
‘// 2. 字段必须按如下顺序,且不能为空: 登录名, 姓名, 密码, 描述
‘// 3. 只能由域管理员才能运行此程序
Option Explicit
Dim oFSO, oTF, objRootDSE, objContainer, i
Dim aLine, sLine, sLogon, sPass
Dim sLoginName, sDisplayName, sDescription
‘// 用户批量文件
Const InpFile = "users.csv"
Const ForReading = 1
Set oFSO = CreateObject("Scripting.FileSystemObject")
Set oTF = oFSO.OpenTextFile(InpFile, ForReading, True)
Set objRootDSE = GetObject("LDAP://rootDSE")
Set objContainer = GetObject("LDAP://cn=Users," & objRootDSE.Get("defaultNamingContext"))
i = 1
Do While oTF.AtEndOfStream <> True
sLine = oTF.ReadLine
aLine = Split(sLine, ",", -1, 1)
sLoginName = aLine(0)
sDisplayName = aLine(1)
sPass = aLine(2)
sDescription = aLine(3)
If IsEmpty(sLoginName) Or IsEmpty(sDisplayName) Then
MsgBox "第 " & i & " 行数据有误:登录名和姓名不能为空", vbExclamation, "Add Bulk Users"
End If
Set objLeaf = objContainer.Create("User", "cn=" & sLoginName)
objLeaf.Put "sAMAccountName", LCase(sLoginName)
objLeaf.Put "givenName", Left(sDisplayName, 1)
objLeaf.Put "sn", Mid(sDisplayName, 2)
objLeaf.Put "UserPrincipalName", LCase(sLogon)
objLeaf.Put "DisplayName", sDisplayName
objLeaf.Put "description", sDescription
objLeaf.SetInfo
‘// 是否重复
If Err.Number = -2147019886 Then
MsgBox "User logon for " & sLogon & " already exists.", vbExclamation, "Bulk Add Users"
Else
‘// Set initial password
objLeaf.setpassword sPass
objLeaf.AccountDisabled = False
objLeaf.SetInfo
End If
i = i + 1
Loop
MsgBox "用户创建完毕.", vbInformation, "Bulk Add Users"
Set oTF = NothingSet oFSO = Nothing
2、清理 IIS Log 中的非重要信息(如 XML、JS、JPG、GIF等资源的访问日志),只留下 asp 和 aspx 的访问日志。经我在一台服务器上测试,日志文件由 6G 变为 900M ,大大节省了空间。
使用方法:保存代码至 .vbs 文件,确认其中关于 IIS 日志路径是否正确,然后运行即可。
代码>> (单击显示/隐藏)