→ 🚀What's New? Join Us for the Fall Product Launch! Register Now !
‎04-26-2015 04:11 AM
{actionspath}openUserProfile.vbs {computer} {username}
Function Ping(strHost)
Dim oPing, oRetStatus, bReturn
Set oPing = GetObject("winmgmts:{impersonationLevel=impersonate}").ExecQuery("select * from Win32_PingStatus where address='" & strHost & "'")
For Each oRetStatus In oPing
If IsNull(oRetStatus.StatusCode) Or oRetStatus.StatusCode <> 0 Then
bReturn = False
Else
bReturn = True
End If
Set oRetStatus = Nothing
Next
Set oPing = Nothing
Ping = bReturn
End Function
Dim Arg, computer, username
Set Arg = WScript.Arguments
Set fso = CreateObject("Scripting.FileSystemObject")
Set shell = WScript.CreateObject("WScript.Shell")
'Parameters
computer = Arg(0)
username = Arg(1)
'Paths
pathW7 = "\\" & computer & "\c$\users\" & username
pathXP = "\\" & computer & "\c$\Documents and settings\" & username
If Ping(computer) Then
exists = fso.FolderExists(pathW7)
If (exists) Then
shell.Run "explorer " & pathW7
WScript.Quit
End If
exists = fso.FolderExists(pathXP)
If (exists) Then
shell.Run "explorer " & pathXP
WScript.Quit
End If
'Not recognized
If (exists = False) then
MsgBox( "Error, the path not exists or is inaccessible.")
WScript.Quit
End If
Else
MsgBox( computer & " is not responding to PING")
End If
‎06-15-2015 03:52 PM
Experience Lansweeper with your own data. Sign up now for a 14-day free trial.
Try Now