Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
strComputer = "[blue].[/blue]"
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colProcessList = objWMIService.ExecQuery _
("SELECT * FROM Win32_Process")
For Each objProcess in colProcessList
colProperties = objProcess.GetOwner(strNameOfUser,strUserDomain)
If objProcess.Name = "[red]notepad.exe[/red]" And strNameOfUser = "[red]markmac[/red]" Then
WScript.Echo "Process " & objProcess.Name & " is running under user: " _
& strUserDomain & "\" & strNameOfUser & "."
End If
Next
strComputer = "."
Dim WSHShell, WSHNetwork, objDomain, DomainString, strNameOfUser, UserString, UserObj, objWMIService, ColProcessList, objProcess
Set WSHShell = CreateObject("WScript.Shell")
Set WSHNetwork = CreateObject("WScript.Network")
DomainString = Wshnetwork.UserDomain
UserString = WSHNetwork.UserName
Set UserObj = GetObject("WinNT://" & DomainString & "/" & UserString)
Set objWMIService = GetObject("winmgmts:" & _
"{impersonationLevel=impersonate}!\\" & _
strComputer & "\root\cimv2")
Set colProcessList = objWMIService.ExecQuery _
("Select * from Win32_Process" & _
" WHERE Name = 'psi.exe'")
For Each objProcess in colProcessList
colProperties = objProcess.GetOwner( _
strNameOfUser,strUserDomain)
If strNameOfUser = UserString Then
WshShell.Run "c:\Intergy\IntergyStart.bat"
'Wscript.Echo "Process: " & objProcess.Name _
'& " is owned by " _
'& strNameOfUser & " and is already running"
Else
WshShell.Run "\\172.16.1.201\profiles\Desktop\Psi.lnk"
End If
Next
set WSHShell = nothing
set WSHNetwork = nothing
set UserObj = nothing
set colProcessList = nothing
set strNameOfUser = nothing
set UserString = nothing
set Userobj = nothing
set objWMIService = nothing
set DomainString = nothing
Set WSHNetwork = CreateObject("Wscript.Network")
UserString = WSHNetwork.UserName
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colProcessList = objWMIService.ExecQuery _
("SELECT * FROM Win32_Process WHERE name = 'psi.exe'")
For Each objProcess in colProcessList
colProperties = objProcess.GetOwner(strNameOfUser,strUserDomain)
If strNameOfUser = UserString Then
WScript.Echo "Process " & objProcess.Name & " is owned by " _
& strUserDomain & "\" & strNameOfUser & "."
End IF
Next
Set WSHNetwork = CreateObject("Wscript.Network")
UserString = WSHNetwork.UserName
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colProcessList = objWMIService.ExecQuery _
("SELECT * FROM Win32_Process WHERE name = 'psi.exe'")
For Each objProcess in colProcessList
colProperties = objProcess.GetOwner(strNameOfUser,strUserDomain)
If strNameOfUser = UserString Then
'Do nothing
Else
WScript.Echo "Process " & objProcess.Name & " is owned by " _
& strUserDomain & "\" & strNameOfUser & "."
End IF
Next
Dim WSHShell, WSHNetwork, objDomain, strNameOfUser, UserString, objWMIService, ColProcessList, objProcess, PsiFlag
Set WSHShell = CreateObject("WScript.Shell")
Set WSHNetwork = CreateObject("WScript.Network")
UserString = WSHNetwork.UserName
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colProcessList = objWMIService.ExecQuery _
("SELECT * FROM Win32_Process WHERE name = 'psi.exe'")
For Each objProcess in colProcessList
colProperties = objProcess.GetOwner(strNameOfUser,strUserDomain)
If strNameOfUser <> UserString Then
PsiFlag = 0
'WScript.Echo "Psi owned by " & strNameOfUser & " NOT " & UserString & "." 'Test for Returned Data
END IF
If strNameOfUser = UserString Then
WshShell.Run "c:\Intergy\IntergyStart.bat"
PsiFlag = 1
'WScript.Echo "Process " & objProcess.Name & " is owned by " _ 'Test for Returned Data
'& strNameOfUser & " Which matches " & UserString & "."
END IF
If IsEmpty(strNameOfUser) Or IsNull(strNameOfUser) Then
PsiFlag = 0
END IF
Next
If PsiFlag = 0 Then
WshShell.Run "\\172.16.1.201\profiles\Desktop\Psi.lnk"
WshShell.Run "c:\Intergy\IntergyStart.bat"
'WScript.Echo "Psi Needs to be started by User" 'Test for Returned Data
END IF
set WSHShell = nothing
set WSHNetwork = nothing
set UserObj = nothing
set colProcessList = nothing
set strNameOfUser = nothing
set UserString = nothing
set Userobj = nothing
set objWMIService = nothing
set DomainString = nothing
set PsiFlag = nothing