Solved

vb script add local profile help

Posted on 2013-06-25
6
878 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 500 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
Technology Partners: 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

Technology Partners: 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!

Question has a verified solution.

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

Suggested Solutions

by Nathan Brom/Bromy2004 Introduction There are numerous websites out there for any different type of program you can imagine.  Of those, you'll need to decide which ones are legitimate and aren't trying to steal your money or infect your comput…
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…
Windows 8 comes with a dramatically different user interface known as Metro. Notably missing from the new interface is a Start button and Start Menu. Many users do not like it, much preferring the interface of earlier versions — Windows 7, Windows X…
Windows 8 came with a dramatically different user interface known as Metro. Notably missing from that interface was a Start button and Start Menu. Microsoft responded to negative user feedback of the Metro interface, bringing back the Start button a…

740 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