0

i have in a few lines of code for the sim-card module (mobile data) to release the pin using AT + CPIN. After that the network adapter does not connect automatically to the network. Therefore I must always click manually on connect in Windows. I would like to do this with a command. I have already tried the following:

 $bbd = get-wmiobject win32_networkadapter -filter "Name = 'Mobilfunk'" | select Name  
    Write $bbd
    Enable-NetAdapter -Name $bbd

or

$bbd.Enable()

But it is still diconnected and i have to click on connect. Do either of you know a solution? I got the Name of the Adapter with Get-NetAdapter -Name *

Michael
  • 43
  • 1
  • 1
  • 6

1 Answers1

0

With this crutch it works:

                $test = netsh mbn show profiles
                $test2=$test.split("{ }")
                $key =$test2[12]
                $output = netsh.exe mbn show interface
                $NameSearchResult = $output | Select-String -Pattern 'Name'
                $MBNname =($NameSearchResult -split ":")
                $MBNname2 =($MBNname -split ":")
                $MBNname3 = $MBNname2[1]
                $MBNnamefinal = ($MBNname3 -split " ")
                Start-Sleep 3.0 # wait 3.0 seconds until device is ready
                netsh mbn connect interface= $MBNnamefinal connmode=name name= $key

Mario Petrovic
  • 7,500
  • 14
  • 42
  • 62
Michael
  • 43
  • 1
  • 1
  • 6