Solved

vb script add local profile help

Posted on 2013-06-25
6
874 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
Migrating Your Company's PCs

To keep pace with competitors, businesses must keep employees productive, and that means providing them with the latest technology. This document provides the tips and tricks you need to help you migrate an outdated PC fleet to new desktops, laptops, and tablets.

 

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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Introduction: I have always been a big fan of Windows but my liking towards it is slowly being eroded by the variety of other Applications that I encounter, when I browse the Web. Most of the software available is free and maybe Open Source too. …
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…
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…

770 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