- ·上一篇文章:VBS脚本显示用户和组及服务
- ·下一篇文章:VBS做的一个木马下载者
- ·百度中搜索更多的关于“VBS脚本显示服务、用户、组的vbs代码”相关内容
- ·谷歌中搜索更多的关于“VBS脚本显示服务、用户、组的vbs代码”相关内容
- ******申明******
- 本站文章内容有部分为收录网络中其他网友内容,DOS资源站不保证所有的代码都适合你使用。
- 由于编辑匆忙,有可能造成某些脚本文件出现丢失代码或代码无法运行的情况,请网友根据情况自行修改。
- 如果能将出错部分反馈给我,那就更好了。
VBS脚本显示服务、用户、组的vbs代码
运行示例:
C:\>cscript "C:\Documents and Settings\Administrator\桌面\s.vbs"
Microsoft (R) Windows Script Host Version 5.6
版权所有(C) Microsoft Corporation 1996-2001。保留所有权利。
+-------codz myvbscript---------------------------------------------+
|We Are Study Vbs. |
|Useage: |
| cscript.exe ser.vbe [serve|user|group] |
+------------------------------------------------------------------------+
代码:
Dim action,wsnetwork,pc,compu
Set wsnetwork=WScript.CreateObject("WScript.Network")
pc=wsnetwork.ComputerName
Set compu=GetObject("WinNT://"&pc)
if (lcase(right(wscript.fullname,11))="wscript.exe") then
wscript.echo "Execute it under the cmd.exe Plz! Thx."
wscript.quit
end If
If Wscript.Arguments.Count = 0 Then
usage
WScript.quit
End If
action=lcase(trim(Wscript.Arguments(0)))
select case action
Case "serve"
serve
Case "user"
user
Case "group"
group
case Else
usage
end Select
function serve()
if Wscript.Arguments.count<2 Then
WScript.Echo "服务显示名:服务名:路径"
For Each s In compu
If s.class="Service" Then
WScript.echo s.displayname &":"&s.name &":"&s.path
End If
Next
WScript.quit
End If
End Function
Function user()
if Wscript.Arguments.count<2 Then
WScript.Echo "用户名:用户描述:所属用户组:"
compu.Filter = Array("User")
For Each oUser In compu
wscript.Echo oUser.Name &":"&oUser.Description&":"&GetItsGroup(oUser.Name)
Next
WScript.quit
End If
End Function
Function GetItsGroup(sUser)
Set oUser = GetObject("WinNT://./" & sUser & ",user")
For Each oGroup In oUser.Groups
GetItsGroup = GetItsGroup & oGroup.Name & " "
Next
End Function
Function group()
If Wscript.Arguments.count<2 Then
wscript.Echo "组名:组描述"
compu.Filter = Array("Group")
For Each oGroup in compu
wscript.Echo oGroup.Name&":"&oGroup.Description
Next
WScript.quit
End If
End Function
function usage()
wscript.echo "+-------codz myvbscript---------------------------------------------+"
wscript.echo "|We Are Study Vbs. |"
wscript.echo "|Useage: |"
wscript.echo "| cscript.exe " &wscript.scriptname&" [serve|user|group] |"
wscript.echo "+-------------------------------------------------------------------------+"&chr(10)
WScript.quit
end Function

