简体   繁体   English

VBS检查多个用户的应用程序数据文件夹

[英]VBS Check application data folder for multiple users

At my job, we have an application that we use (Mikogo) that installs into the user directory in the App Data folder, instead of into the Program Files folder. 在我的工作中,我们有一个使用的应用程序(Mikogo)安装在App Data文件夹的用户目录中,而不是安装在Program Files文件夹中。

Mikogo has released an update, so I want to find out which computers it is installed on so I can update the software. Mikogo已发布了一个更新,因此,我想找出安装该更新的计算机,以便更新该软件。 To do this, I want to parse through a list of computers and check to see if the "Mikogo 4" folder exists within the App Data folder for each user on the computer. 为此,我想解析计算机列表,并检查计算机上每个用户的App Data文件夹中是否存在“ Mikogo 4”文件夹。

I know how to parse through a list of computers, I know how to check to see if a folder exists, I even know how get the location of the App Data folder... my problem is that I don't know how to get the location of the App Data folder for each individual user on the computer that I am currently checking. 我知道如何解析计算机列表,我知道如何检查文件夹是否存在,甚至知道如何获取App Data文件夹的位置...我的问题是我不知道如何获取我当前正在检查的计算机上每个用户的App Data文件夹的位置。

Is there a way for me to check each individual App Data folder? 我有办法检查每个单独的App Data文件夹吗?

Something like this might do: 这样的事情可能会做:

Const regProfilesDir = "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList\ProfilesDirectory"
Const appDataDir     = "AppData\Roaming"

Set sh  = CreateObject("WScript.Shell")
Set fso = CreateObject("Scripting.FileSystemObject")

profilesDir = sh.ExpandEnvironmentStrings(sh.RegRead(regProfilesDir))

For Each user In fso.GetFolder(profilesDir).SubFolders
  If fso.FolderExists(fso.BuildPath(user.Path, appDataDir & "\Mikogo 4")) Then
    WScript.Echo "Application folder exists for user " & user & "."
  End If
Next

However, Windows versions prior to Vista used a different name for the AppData folder, and the name was localized too. 但是,Vista之前的Windows版本为AppData文件夹使用了不同的名称,并且该名称也已本地化。 If you have older Windows versions in your environment, you'll have to handle that as well. 如果您的环境中有较旧的Windows版本,则也必须处理该问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM