어떻게 VBS 스 크 립 트 로 원 격 컴퓨터 나 로 컬 컴퓨터 에 설 치 된 소프트웨어 를 수집 합 니까?
10017 단어 VBS컴퓨터.설 치 된 소프트웨어
VBS 스 크 립 트 로 도 메 인 에 있 는 원 격 컴퓨터 나 로 컬 컴퓨터 에 설 치 된 소프트웨어,Windows 버 전 을 수집 합 니 다.수 집 된 결 과 를 파일 이름 의 텍스트 파일 에 저장 합 니 다.텍스트 파일 은 네트워크 경로 나 현재 VBS 파일 이 있 는 디 렉 터 리 에 저장 할 수 있 습 니 다.32 비트 와 64 비트 시스템 을 동시에 지원 합 니 다.
패 치 패키지,Office 구성 요소,NVIDIA,Intel 을 걸 러 냅 니 다.®의 구동 등.
VBS 스 크 립 트 만 들 기
다음 VBS 프로그램 코드 를 vbs 파일 에 저장 합 니 다.
On Error Resume Next
Const HKCU = &h80000001
Const HKLM = &H80000002
Const strKeyPath = "Software\Microsoft\Windows\CurrentVersion\Uninstall\"
Const str64KeyPath = "SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\"
Const ForReading = 1
Const ForWriting = 2
Const ForAppending = 8
'FilePath = "\\Server-File\PCSoftList\"
FilePath = CreateObject("Scripting.FileSystemObject").GetFolder(".").Path & "\"
Set Wshell = CreateObject("Wscript.Shell")
Set objFSO = CreateObject("Scripting.FileSystemobject")
'Set collected computers Name
set argus=wscript.arguments
if argus.count=0 then
strComputerName = Wshell.RegRead("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\Hostname")
else
strComputerName = argus(0)
end if
Set textWriteFile = objFSO.OpenTextFile(FilePath & ucase(strComputerName) &".txt",ForWriting,True,True)
Set objReg = GetObject("winmgmts://" & strComputerName & "/root/default:StdRegProv")
'Get OS Version
intRet = objReg.GetStringValue(HKLM, "SOFTWARE\Microsoft\Windows NT\CurrentVersion","ProductName",strOSVersion)
If intRet = 0 Then
intRet = objReg.GetStringValue(HKLM, "SOFTWARE\Microsoft\Windows NT\CurrentVersion","CSDVersion",strOSServicePack)
intRet = objReg.GetStringValue(HKLM, "SOFTWARE\Wow6432Node\Microsoft\Windows NT\CurrentVersion","ProductName",str64BitOSVersion)
if intRet = 0 then
strOSVersion = strOSVersion & " 64bit"
end if
intRet = objReg.GetStringValue(HKLM, "SYSTEM\CurrentControlSet\Control\Nls\Language","InstallLanguage",OSLanguageCode)
if intRet = 0 then
select case OSLanguageCode
case "0804" '
strOSVersion = strOSVersion & " Chinese Version"
case "0411" '
strOSVersion = strOSVersion & " Japanese Version"
case "0409" '
strOSVersion = strOSVersion & " English Version"
case else '
strOSVersion = strOSVersion & " UnknownLanguage Version"
end select
end if
Else
strOSVersion = "OS Get Failed"
strOSServicePack = "NoFind"
End If
if InStr(LCase(strOSVersion),"windows")>0 then
textWriteFile.WriteLine("""" & ucase(strComputerName) & """" & vbTab & """" & strOSVersion & """" & vbTab & """" & strOSServicePack & """")
end if
'Display User Software.
objReg.EnumKey HKCU, strKeyPath,arrSubKeys
For Each strSubKey In arrSubKeys
intGet = objReg.GetDWORDValue(HKCU, strKeyPath & strSubKey,"SystemComponent",intSystemComponent)
If IsNull(intSystemComponent) then
intSystemComponent = 0
End If
intRet = objReg.GetStringValue(HKCU, strKeyPath & strSubKey,"ParentDisplayName",strName)
If intSystemComponent = 0 and intRet > 0 then
intRet = objReg.GetStringValue(HKCU, strKeyPath & strSubKey,"DisplayName",strName)
If strName <> "" And intRet = 0 And ignorePgm(strName) Then
strName = replace(replace(strName,vbCrLf,""),vbTab,"")
intRet = objReg.GetStringValue(HKCU, strKeyPath & strSubKey,"DisplayVersion",strVersion)
textWriteFile.WriteLine("""" & ucase(strComputerName) & """" & vbTab & """" & strName & """" & vbTab & """" & strVersion & """")
End If
End If
Next
'Display Machine 32bit Software.
objReg.EnumKey HKLM, strKeyPath,arrSubKeys
For Each strSubKey In arrSubKeys
intGet = objReg.GetDWORDValue(HKLM, strKeyPath & strSubKey,"SystemComponent",intSystemComponent)
If IsNull(intSystemComponent) then
intSystemComponent = 0
End If
intRet = objReg.GetStringValue(HKLM, strKeyPath & strSubKey,"ParentDisplayName",strName)
If intSystemComponent = 0 and intRet > 0 then
intRet = objReg.GetStringValue(HKLM, strKeyPath & strSubKey,"DisplayName",strName)
If strName <> "" And intRet = 0 And ignorePgm(strName) Then '
strName = replace(replace(strName,vbCrLf,""),vbTab,"")
intRet = objReg.GetStringValue(HKLM, strKeyPath & strSubKey,"DisplayVersion",strVersion)
textWriteFile.WriteLine("""" & ucase(strComputerName) & """" & vbTab & """" & strName & """" & vbTab & """" & strVersion & """")
End If
End If
Next
'Display Machine 64bit Software.
objReg.EnumKey HKLM, str64KeyPath,arrSubKeys
For Each strSubKey In arrSubKeys
intGet = objReg.GetDWORDValue(HKLM, str64KeyPath & strSubKey,"SystemComponent",intSystemComponent)
If IsNull(intSystemComponent) then
intSystemComponent = 0
End If
intRet = objReg.GetStringValue(HKLM, str64KeyPath & strSubKey,"ParentDisplayName",strName)
If intSystemComponent = 0 and intRet > 0 then
intRet = objReg.GetStringValue(HKLM, str64KeyPath & strSubKey,"DisplayName",strName)
If strName <> "" And intRet = 0 And ignorePgm(strName) Then
strName = replace(replace(strName,vbCrLf,""),vbTab,"")
intRet = objReg.GetStringValue(HKLM, str64KeyPath & strSubKey,"DisplayVersion",strVersion)
textWriteFile.WriteLine("""" & ucase(strComputerName) & """" & vbTab & """" & strName & """" & vbTab & """" & strVersion & """")
End If
End If
Next
textWriteFile.Close
function ignorePgm(strPgm)
If inStr(1,strPgm,"Microsoft Office ",1)<=0 then
' Security Update、.NET Framework、Microsoft Visual C++、NVIDIA、Intel(R)
ignorePgm = inStr(1,strPgm,"Security Update",1)<=0 _
And inStr(1,strPgm,".NET Framework",1)<=0 _
And inStr(1,strPgm,"Microsoft Visual C++",1)<=0 _
And inStr(1,strPgm,"NVIDIA",1)<=0 _
And inStr(1,strPgm,"Intel(R)",1)<=0
Else
' Office
ignorePgm = inStr(1,strPgm,"Microsoft Office ",1)>0 _
And (inStr(1,strPgm," 2000 ",1)>0 _
Or inStr(1,strPgm," 2003 ",1)>0 _
Or (inStr(1,strPgm,"Microsoft Office Access ",1)=1 And inStr(1,strPgm," MUI",1)<=0) _
Or strPgm="Microsoft Office Professional Plus 2007" _
Or strPgm="Microsoft Office Professional Plus 2010" _
Or strPgm="Microsoft Office Professional Plus 2016" _
Or strPgm="Microsoft Office Standard 2007" _
Or strPgm="Microsoft Office Standard 2010" _
Or strPgm="Microsoft Office Standard 2016" _
Or strPgm="Microsoft Office Standard 2019")
End If
end function
저 장 된 파일 이름 이 InstalledSoftList.vbs 라 고 가정 합 니 다.D:\에 저장결과 파일 저장 경 로 를 수정 합 니 다.
다음 코드 를 수정 하 십시오
'FilePath = "\\Server-File\PCSoftList\"
FilePath = CreateObject("Scripting.FileSystemObject").GetFolder(".").Path & "\"
현재 기본 값 은 Installed SoftList.vbs 파일 이 있 는 디 렉 터 리 에 저 장 됩 니 다.수정 안 해도 돼.필터 조건 수정(표시 하고 싶 지 않 은 프로그램 이름 설정)
다음 코드 를 수정 하 십시오
' Security Update、.NET Framework、Microsoft Visual C++、NVIDIA、Intel(R)
ignorePgm = inStr(1,strPgm,"Security Update",1)<=0 _
And inStr(1,strPgm,".NET Framework",1)<=0 _
And inStr(1,strPgm,"Microsoft Visual C++",1)<=0 _
And inStr(1,strPgm,"NVIDIA",1)<=0 _
And inStr(1,strPgm,"Intel(R)",1)<=0
기본적으로 보안 업데이트,.NET Framework,Microsoft Visual C++,NVIDIA,Intel 을 표시 하지 않 습 니 다.®절차테스트 전에 수정 하지 않 아 도 됩 니 다.
테스트
테스트 방법 1
현재 컴퓨터 에 설 치 된 소프트웨어 수집
InstalledSoftList.vbs 를 직접 더 블 클릭
컴퓨터 이름 이 PC-name 01 이 라 고 가정 하면 D:\또는 지정 한 디 렉 터 리 에서 PC-name 01.txt 라 는 파일 을 생 성 합 니 다.
테스트 방법 2
원 격 컴퓨터 에 설 치 된 소프트웨어 를 수집 하 다.
CMD 창 에서 다음 명령 을 실행 합 니 다.(컴퓨터 이름 이 PC-name 02 라 고 가정)
cscript d:\InstalledSoftList.vbs PC-Name02
D:\또는 지정 한 디 렉 터 리 아래 에 PC-name 02.txt 라 는 파일 을 생 성 합 니 다.
테스트 방법 2 의 주의사항
실행 후 얻 은 PC-name 02.txt 파일 이 비어 있 으 면.아래 두 가지 내용 을 확인 하 세 요.
4.567917.원 격 컴퓨터 가 스 크 립 트 를 실행 해 야 하 는 컴퓨터 는 같은 도 메 인 에 있 는 구성원 컴퓨터 입 니 다
이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
[반도체 메모리] 기본 정보 기술자의 테스트에 사용되는 컴퓨터의 구조이것은'백목 선생님의 기본 정보 기술자 교실'을 참고하여 학습 내용을 총결한 문장이다. RAM(Random Access Memory)은 읽기와 쓰기가 가능한 메모리입니다.전원을 끊으면 저장된 내용이 사라지는 특성이 ...
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.