Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

vb script add local profile help

Posted on 2013-06-25
6
Medium Priority
?
902 Views
1 Endorsement
Last Modified: 2013-06-27
When I run the script below with an elevated cmd prompt, it generates a null error in line 5 character 1 " file not found.   The file is there. I can run the cmd using a cmd window or similar using a bat file. It just will not find the file using vbs. Any help would be greatly appreciated! Thank You!

( *this is the line) objshell.Run "%compsec% /c netsh lan add profile filename=%systemdrive%\windows\system32\LocalAreaConnection.xml interface=" & Q & "Local Area Connection" & Q, 0, True



Full script for SCCM OSD 8021x deployments.

Set objshell = CreateObject("Wscript.Shell")
 Q = chr(34)
 objshell.Run "%comspec% /c net start dot3svc", 0, True
 objshell.Run "%comspec% /c netsh lan set autoconfig enabled=yes interface=" & Q & "Local Area Connection" & Q, 0, True
 objshell.Run "%compsec% /c netsh lan add profile filename=%systemdrive%\windows\system32\LocalAreaConnection.xml interface=" & Q & "Local Area Connection" & Q, 0, True
 objshell.Run "%comspec% /c netsh lan set eapuserdata filename = %systemdrive%\windows\system32\uprofile.xml allusers=yes interface=" & Q & "Local Area Connection" & Q, 0, True
 objshell.Run "%comspec% /c netsh lan reconnect interface =" & Q & "Local Area Connection" & Q, 0, True
 objshell.Run "%comspec% /c del %SYSTEMDRIVE%\windows\system32\uprofile.xml /Q", 0, True
1
Comment
Question by:sette525
  • 3
  • 3
6 Comments
 
LVL 14

Expert Comment

by:brendanmeyer
ID: 39276597
try this - not sure if its going to help

Set objshell = CreateObject("Wscript.Shell")
 objshell.Run "%comspec% /c net start dot3svc", 0, True
 objshell.Run "%comspec% /c netsh lan set autoconfig enabled=yes interface=""Local Area Connection""", 0, True
 objshell.Run "%compsec% /c netsh lan add profile filename=""%systemdrive%\windows\system32\LocalAreaConnection.xml"" interface=""Local Area Connection""", 0, True
 objshell.Run "%comspec% /c netsh lan set eapuserdata filename = ""%systemdrive%\windows\system32\uprofile.xml"" allusers=yes interface=""Local Area Connection""", 0, True
 objshell.Run "%comspec% /c netsh lan reconnect interface =""Local Area Connection""", 0, True
 objshell.Run "%comspec% /c del ""%SYSTEMDRIVE%\windows\system32\uprofile.xml"" /Q", 0, True

Open in new window

0
 

Author Comment

by:sette525
ID: 39276654
Thank You for the reply.
Same error different line  (4, 2 ) (null): The system cannot find the file specified.
0
 
LVL 14

Accepted Solution

by:
brendanmeyer earned 2000 total points
ID: 39276658
ok try either
Set objshell = CreateObject("Wscript.Shell")
 objshell.Run "net start dot3svc", 0, True
 objshell.Run "netsh lan set autoconfig enabled=yes interface=""Local Area Connection""", 0, True
 objshell.Run "netsh lan add profile filename=""%systemdrive%\windows\system32\LocalAreaConnection.xml"" interface=""Local Area Connection""", 0, True
 objshell.Run "netsh lan set eapuserdata filename = ""%systemdrive%\windows\system32\uprofile.xml"" allusers=yes interface=""Local Area Connection""", 0, True
 objshell.Run "netsh lan reconnect interface =""Local Area Connection""", 0, True
 objshell.Run "%comspec% /c del ""%SYSTEMDRIVE%\windows\system32\uprofile.xml"" /Q", 0, True

Open in new window


or

Set objshell = CreateObject("Wscript.Shell")
 objshell.Run "net start dot3svc", 0, True
 objshell.Run "netsh lan set autoconfig enabled=yes interface=""Local Area Connection""", 0, True
 strCmd = "netsh lan add profile filename=""%systemdrive%\windows\system32\LocalAreaConnection.xml"" interface=""Local Area Connection"""
 objshell.Run strCmd, 0, True
 strCmd = "netsh lan set eapuserdata filename = ""%systemdrive%\windows\system32\uprofile.xml"" allusers=yes interface=""Local Area Connection"""
 objshell.Run strCmd, 0, True
 objshell.Run "netsh lan reconnect interface =""Local Area Connection""", 0, True
 strCmd = "%comspec% /c del ""%SYSTEMDRIVE%\windows\system32\uprofile.xml"" /Q"
 objshell.Run strCmd, 0, True

Open in new window

0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:sette525
ID: 39276682
Those look promising in testing from a cmd prompt. I will put it all together in  SCCM tomorrow and test.
Thanks again for the help!
0
 
LVL 14

Expert Comment

by:brendanmeyer
ID: 39277321
No Problem, Hope it works
0
 

Author Comment

by:sette525
ID: 39282961
Thanks again, it worked.
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Many times while working on a computer regardless of any Operating System, lag and crashes seem to creep in, hindering your working speed. Sometimes, it can also cause your work to be lost unexpectedly and as a result, you are unable to meet your de…
When you upgrade from Windows 8 to 8.1 or to Windows 10 or if you are like me you are on the Insider Program you may find yourself with many 450MB recovery partitions.  With a traditional disk that may not be a problem but with relatively smaller SS…
This video Micro Tutorial explains how to clone a hard drive using a commercial software product for Windows systems called Casper from Future Systems Solutions (FSS). Cloning makes an exact, complete copy of one hard disk drive (HDD) onto another d…
With the advent of Windows 10, Microsoft is pushing a Get Windows 10 icon into the notification area (system tray) of qualifying computers. There are many reasons for wanting to remove this icon. This two-part Experts Exchange video Micro Tutorial s…

885 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question