Solved

vb script add local profile help

Posted on 2013-06-25
6
866 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 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
Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

 

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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

Preface Having the need * to contact many different companies with different infrastructures * do remote maintenance in their network required us to implement a more flexible routing solution. As RAS, PPTP, L2TP and VPN Client connections are no…
The way I use Experts Exchange to assist me in analyzing and diagnosing a problem is I first enter a Verbose Question at Experts Exchange like: Office 2007 will hang when opening and saving files I then launch WordPad (any text editor will do) an…
In this video, we discuss why the need for additional vertical screen space has become more important in recent years, namely, due to the transition in the marketplace of 4x3 computer screens to 16x9 and 16x10 screens (so-called widescreen format). …
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…

744 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now