Bianchi928
asked on
Needs domain\username & password
I'm having a permission problem to get the following script to work.Can someone fix the
script for me
eg strUsername = "domain\username"
strPassword = "password"
strInputFile = "ComputerUsers.txt"
Dim objShell, objFSO, objInput, strComputer, strUser, objShortcut, strLine
Const ForReading = 1
Set objShell = CreateObject("WScript.Shel l")
Set objFSO = CreateObject("Scripting.Fi leSystemOb ject")
Set objInput = objFSO.OpenTextFile(strInp utFile, ForReading, False)
While Not objInput.AtEndOfStream
strLine = objInput.ReadLine
If InStr(strLine, ":") > 0 Then
strComputer = Split(strLine, ":")(0)
strUser = Split(strLine, ":")(1)
If Ping(strComputer) = True Then
If objFSO.FolderExists("\\" & strComputer & "\C$\Documents and Settings\" & strUser & "\Desktop") = True Then
Set objShortcut = objShell.CreateShortcut("\ \" & strComputer & "\C$\Documents and Settings\" & strUser & "\Desktop\My_Documents.lnk ")
objShortcut.Description = "Network Source File Storage"
objShortcut.TargetPath = "\\tyrenet-14\transfer\" & strUser & "\my_documents"
objShortcut.IconLocation = "C:\Windows\System32\shell 32.dll, 19"
objShortcut.Save
End If
End If
End If
Wend
objInput.Close
Function Ping(strComputer)
Dim objShell, boolCode
Set objShell = CreateObject("WScript.Shel l")
boolCode = objShell.Run("Ping -n 1 -w 300 " & strComputer, 0, True)
If boolCode = 0 Then
Ping = True
Else
Ping = False
End If
End Function
script for me
eg strUsername = "domain\username"
strPassword = "password"
strInputFile = "ComputerUsers.txt"
Dim objShell, objFSO, objInput, strComputer, strUser, objShortcut, strLine
Const ForReading = 1
Set objShell = CreateObject("WScript.Shel
Set objFSO = CreateObject("Scripting.Fi
Set objInput = objFSO.OpenTextFile(strInp
While Not objInput.AtEndOfStream
strLine = objInput.ReadLine
If InStr(strLine, ":") > 0 Then
strComputer = Split(strLine, ":")(0)
strUser = Split(strLine, ":")(1)
If Ping(strComputer) = True Then
If objFSO.FolderExists("\\" & strComputer & "\C$\Documents and Settings\" & strUser & "\Desktop") = True Then
Set objShortcut = objShell.CreateShortcut("\
objShortcut.Description = "Network Source File Storage"
objShortcut.TargetPath = "\\tyrenet-14\transfer\" & strUser & "\my_documents"
objShortcut.IconLocation = "C:\Windows\System32\shell
objShortcut.Save
End If
End If
End If
Wend
objInput.Close
Function Ping(strComputer)
Dim objShell, boolCode
Set objShell = CreateObject("WScript.Shel
boolCode = objShell.Run("Ping -n 1 -w 300 " & strComputer, 0, True)
If boolCode = 0 Then
Ping = True
Else
Ping = False
End If
End Function
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Glad to help. Thanks for the grade.
Rob.
Rob.
ASKER