Solved

vb script add local profile help

Posted on 2013-06-25
6
869 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Autotask Connectwise PSA 3 74
SSAS,SSIS scaleout 3 40
Why does detection of a slow link to a user's roaming profile not work? 2 45
RDP Trouble shooting 12 106
This article describes how to set permissions to allow a limited-permissions user to start and stop a particular System Service.   It is always best to give users only the permissions that they need to perform their job, so tweaking particular permi…
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…

863 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

27 Experts available now in Live!

Get 1:1 Help Now