This VBS is to open a remote user profile folder, is intended for W7 and XP.
Need to be defined in your asset page like:
{actionspath}openUserProfile.vbs {computer} {username}
The script first will ping the computer, if fails will pop a msg box alerting and stop.
Will test if the path exists and open a explorer with the UNC path, if the path not exists will pop a msg box alerting.
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