vmware citrix
This is an addendum to the following article:
这是以下文章的附录:Acitve Directory based Outlook Signature基于Acitve目录的Outlook签名
The script is fine, and works in normal client-server domains.
该脚本很好,并且可以在普通的客户端-服务器域中使用。
If you want to use the script on a Citrix or Terminal Services server, the IsOutlookFunction stops if anyone on the server has Outlook running. In this case, you want to check only if Outlook is running for the current user:
如果要在Citrix或终端服务服务器上使用脚本,则如果服务器上的任何人都在运行Outlook,则IsOutlookFunction将停止。 在这种情况下,您只想检查当前用户是否正在运行Outlook:
I changed the code as follows:
我将代码更改如下:
Function IsOutlookRunning() strComputer = "." strQuery = "Select * from Win32_Process " & _ "Where Name = 'OUTLOOK.EXE'" Set objWMIService = GetObject("winmgmts:" _ & "{impersonationLevel=impersonate}!\\" _ & strComputer & "\root\cimv2") Set colProcesses = objWMIService.ExecQuery(strQuery) For Each objProcess In colProcesses => colProperties = objProcess.GetOwner(strNameOfUser,strUserDomain) If UCase(objProcess.Name) = "OUTLOOK.EXE" Then=> If objSysInfo.Username = strNameOfUser Then IsOutlookRunning = True=> Else=> IsOutlookRunning = False=> End if Else IsOutlookRunning = False End If NextEnd FunctionThis script checks for a running "Outlook.exe" process for the current user.
该脚本为当前用户检查正在运行的“ Outlook.exe”进程。
I found the code that I added from the Question/Answer "Hey, Scripting Guy! Blog" website.
我在“问题/答案”“ 嗨,脚本专家!博客 ”网站上找到了添加的代码。
Most of the time Google is your friend in finding the right code--you only have to know how to incorporate it into you're own scripts.
在大多数情况下,Google都是您寻找正确代码的朋友-您只需要知道如何将其合并到自己的脚本中即可。
I used the GetOwner method, which returns two variables--one that returns the name of the user who 'owns' the process, and another that returns the domain that the user belongs to. We do not need the domain, so I left it alone. In my script above, I used variables named "strUserName" and "strUserDomain". These names are not important--you can call the variables "A" and "B", or "X" and "Y", or anything you want--however, a descriptive name is preferable.
我使用了GetOwner方法,该方法返回两个变量-一个返回“拥有”该进程的用户的名称,另一个返回该用户所属的域。 我们不需要该域,因此我将其保留。 在上面的脚本中,我使用了名为“ strUserName”和“ strUserDomain”的变量。 这些名称并不重要-您可以将变量称为“ A”和“ B”,或“ X”和“ Y”,或任何您想要的名称-但是,描述性名称是更可取的。
Each "Outlook.exe" process is examined to see if the owner is the current user. When the owner is the current user, we will use IsOutlookRunning to check if Outlook is running. If it is running, IsOutlookRunning returns TRUE. In all other cases, where Outlook is not running, or all Outlook processes are owned by other users, IsOutlookRunning returns FALSE.
检查每个“ Outlook.exe”进程,以查看所有者是否为当前用户。 当所有者是当前用户时,我们将使用IsOutlookRunning检查Outlook是否正在运行。 如果正在运行,则IsOutlookRunning返回TRUE。 在所有其他情况下,如果Outlook没有运行,或者所有Outlook进程都由其他用户拥有,则IsOutlookRunning返回FALSE。
I hope this code is useful for people who want to use an automated signature with Outlook on Terminal Services or Citrix servers.
我希望此代码对希望在终端服务或Citrix服务器上的Outlook中使用自动签名的人有用。
Of course, this method may be used in many other cases where you want to know the owner of a process.
当然,在您想了解流程所有者的其他许多情况下,也可以使用此方法。
Kind regards,
亲切的问候,
Carlo van Orsouw
卡洛·范·奥尔索
Princen Group
普林斯集团
The Netherlands
荷兰人
翻译自: https://www.experts-exchange.com/articles/2784/Change-IsOutlookSignature-in-a-Citrix-Terminal-Server-environment.html
vmware citrix
免责声明:本文系网络转载或改编,未找到原创作者,版权归原作者所有。如涉及版权,请联系删