question

Alexis-1304 avatar image
0 Votes"
Alexis-1304 asked MotoX80 answered

task not working after deploying with gpo

Good afternoon reader,

I've made a virtual samba ad that runs windows 2008R2 (i couldn't upgrade to 2012R2 even though it's samba 4.15, not the issue right now) and i've authenticated a virtual windows 10 computer agaisn't it.
I installed the RSAT tools on the virtual windows computer. GPO and Lightweight directory.
I created some users and a group policies to try things out.

Everything works well except a task scheduler gpo. When I look at gpresult, the gpo is applied without any issue.

Here's my gpo :

204059-capture-20220520152332-626x471.png

204171-gnome-shell-screenshot-gx09jc.png


I can also find it in the administrator task scheduler on the client :

204154-capture-20220520151317-651x237.png


What it does : it should start the rasdial.exe executable and, with the vpn connection "Linkso VPN" as argument it should start the vpn at the boot of the machine.

But nothing happens. I went to the admin task scheduler and executed it manually but it stucks on "ready" and nothing happens.

The event viewer doesn't notice anything except some past errors about past gpos that don't apply to the machine.

What i've found so far about this was a user security issue but nothing that really compares to my issue. I'm not that experienced in ldap and i've wanted some tips or leads if possible...

I feel like i miss the difference between a local and a computer local task scheduler...

Thanks in advance for any answer, have a fantastic day !


windows-serverwindows-group-policy
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

MotoX80 avatar image
0 Votes"
MotoX80 answered Alexis-1304 commented

You have to capture the output (stdout/stderr) that rasdial.exe displays in order to know what error it encountered.

Create a c:\temp\vpn.bat file that calls it.


 @echo %date% %time% Task starting.
 C:\Windows\System32\rasdial.exe  "Linkso VPN" 
 @echo %date% %time% Task ending. Result = %errorlevel%

Modify the task to call cmd.exe with this argument.

 /c c:\temp\vpn.bat 1>>c:\temp\vpn.log 2>&1

Run the task and then review the log.



· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hey, thanks for the quick answer !

I get this error :

20/05/2022 16:34:01,04 Task starting.

C:\Windows\system32>C:\Windows\System32\rasdial.exe "Linkso VPN"


Erreur d'AccŠs distant 623 - Le systŠme n'a pas pu trouver l'entr‚e de l'Annuaire t‚l‚phonique.

Pour plus d'information sur cette erreurÿ:
Entrez la commande 'hh netcfg.chm'
Dans l'aide, cliquez sur D‚pannage, puis sur Messages d'erreur, puis
sur 623
20/05/2022 16:34:01,07 Task ending. Result = 623




I've already seen this error in the past. It's when rasdial doesn't find rasphone, which is weird because when I start the bat file alone it starts the vpn connection successfully.
When I start the task a second time while being connected, I get the error that i'm already connected to "Linkso VPN" so i'm assuming it does find it...

20/05/2022 16:32:58,89 Task starting.

C:\Windows\system32>C:\Windows\System32\rasdial.exe "Linkso VPN"
Vous ˆtes d‚j… connect‚ sur Linkso VPN.
La commande a ‚t‚ ex‚cut‚e.
20/05/2022 16:32:58,92 Task ending. Result = 0

0 Votes 0 ·


Also i've tried on another virtual machine by creating a task manually in the task scheduler and it starts the vpn connexion at boot without problem.
I forgot to add the actions :
204119-capture-20220520163759-730x544.png


What I assume is that the task that isn't working, that is in the administrator task scheduler can't find rasphone.
Also I can't open netcfg.chm.

I went back to %APPDATA%\Microsoft\Network\Connections\Pbk\
My rasphone.pbk file is here, and another rasphone.pbk in %APPDATA%\Microsoft\Network\Connections\Pbk_hiddenPbk

Now what is weird is that the one in _hiddenPbk doesn't have a connection at all.
Even if i copy/paste the one in Pbk that has the Linkso VPN connection, it goes back to empty. Maybe it starts this file instead of the one with Linkso VPN?

204147-capture-20220520164608-1568x584.png


0 Votes 0 ·
MotoX80 avatar image
0 Votes"
MotoX80 answered

I went back to %APPDATA%\Microsoft\Network\Connections\Pbk\

%APPDATA% points to my user folders.

 C:\>set app
 APPDATA=C:\Users\Dave\AppData\Roaming

If your task is running as the system account, then I'm not sure what folder that will get resolved to. Do you copy the phonebook somewhere? You might have to use the /PHONEBOOK:phonebookfile switch.

If the task is running at startup, then maybe you need add in a delay to let the network fully initialize before trying to initialize the VPN. Verify that the phonebook exists and contains your entry.

 @echo %date% %time% Task starting.
 @timeout /t 30 > nul
 @echo %date% %time% Finished with startup delay.
 @echo.
 dir %APPDATA%\Microsoft\Network\Connections\Pbk\
 @echo.
 @echo.
 type %APPDATA%\Microsoft\Network\Connections\Pbk\rasphone.pbk
 @echo.
 @echo.
 @echo %date% %time% Calling rasdial.
 C:\Windows\System32\rasdial.exe "Linkso VPN" 
 @echo %date% %time% Task ending. Result = %errorlevel%




5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.