Answer the question
In order to leave comments, you need to log in
How to establish a PPPoE connection using Powershell?
Good day. How to establish a PPPoE connection using Powershell?
Important: without resorting to rasphone.exe and rasdial.exe .
Answer the question
In order to leave comments, you need to log in
Unfortunately, this only displays a connection window, followed by another window, and so on. It doesn't connect.
Although in Windows 8 this window displayed on the connection immediately, without new crazy metro windows.
$itemName = 'Ростелеком'
$pressIt = 'Подкл&ючить/отключить'
$sa = New-Object -ComObject Shell.Application
$sa.NameSpace(49).Items() | foreach ({
if($_.Name -eq $itemName){
$_.Verbs() | foreach ({
if ($_.name -eq $pressIt){
$_.DoIt()
break
}
})
}
})
$x='Ростелеком'
$a='login';
$b='password';
$c=$env:WINDIR+'\System32\rasdial.exe';
&$c @($x,$a,$b) 2>&1|ForEach{
$_
};
something like this... just plug in the name of the pppoe connection instead of MyDialup. and if Windows is Russian, then you will probably need to change the script, looking at what $sa.NameSpace (49). Items () is and how it is called in Russian.
$sa = New-Object -ComObject Shell.Application
$connections = $sa.NameSpace(49).Items()
$dialupName = "MyDialup"
for($i=0;$i -lt $connections.Count;$i++) {
if($connections.Item($i).name -eq $dialupName){
$dialup = $connections.Item($i);
break;
}
}
$connect = 'C&onnect'
$verbs = $dialup.Verbs()
for($i=0;$i -lt $verbs.Count;$i++){
if($verbs.Item($i).name - eq $connect){
$verbs.Item($i).DoIt();
break;
}
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question