Intune PowerShell scripts

%3CLINGO-SUB%20id%3D%22lingo-sub-692138%22%20slang%3D%22en-US%22%3EIntune%20PowerShell%20scripts%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-692138%22%20slang%3D%22en-US%22%3E%3CP%3EHi%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI'm%20currently%20trying%20to%20run%20a%20PS%20script%20to%20add%20a%20VPN%20connection%20through%20Intune%20PowerShell.%3C%2FP%3E%3CP%3EWhen%20the%20script%20is%20run%20directly%20in%20powershell%20it%20executes%20as%20it%20should%2C%20adding%20the%20VPN%20connection.%3C%2FP%3E%3CP%3EOn%20the%20other%20hand%2C%20if%20it%20executes%20through%20Intune%20PowerShell%2C%20nothing%20happens.%20I've%20searched%20the%20intune%20logs%20on%20targeted%20user's%20PC%20and%20also%20the%20online%20Intune%20portal%20where%20the%20script%20has%20a%3A%20Succeeded%20status.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EAm%20I%20doing%20something%20wrong%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-692138%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EIntune%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-692413%22%20slang%3D%22en-US%22%3ERe%3A%20Intune%20PowerShell%20scripts%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-692413%22%20slang%3D%22en-US%22%3EHi%20Nikola%2C%20what%20settings%20have%20used%20in%20the%20PowerShell%20policy...%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-692680%22%20slang%3D%22en-US%22%3ERe%3A%20Intune%20PowerShell%20scripts%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-692680%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F346060%22%20target%3D%22_blank%22%3E%40neilcarden%3C%2FA%3E%26nbsp%3BAdd-VpnConnection%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-692713%22%20slang%3D%22en-US%22%3ERe%3A%20Intune%20PowerShell%20scripts%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-692713%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F69264%22%20target%3D%22_blank%22%3E%40Nikola%20Nenadovic%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EApologies%2C%20I%20meant%20here%3A%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F118123i3738B11ECA003346%2Fimage-size%2Fmedium%3Fv%3D1.0%26amp%3Bpx%3D400%22%20alt%3D%22Capture.PNG%22%20title%3D%22Capture.PNG%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-692715%22%20slang%3D%22en-US%22%3ERe%3A%20Intune%20PowerShell%20scripts%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-692715%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F346060%22%20target%3D%22_blank%22%3E%40neilcarden%3C%2FA%3EI've%20used%20the%20same%20settings%20as%20on%20your%20image%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-696017%22%20slang%3D%22en-US%22%3ERe%3A%20Intune%20PowerShell%20scripts%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-696017%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F69264%22%20target%3D%22_blank%22%3E%40Nikola%20Nenadovic%3C%2FA%3ETry%20setting%20%22Run%20script%20in%2064%20bit%20PowerShell%20host%20(when%20available)%22%20to%20%22Yes%22.%20I%20have%20found%20some%20very%20strange%20behavior%20when%20the%20scripts%20run%20within%20the%2032-bit%20emulator.%20Things%20like%2C%20registry%20setting%20changes%20that%20only%20affect%20that%20Powershell%20session.%3C%2FP%3E%3C%2FLINGO-BODY%3E
Highlighted
Contributor

Hi,

 

I'm currently trying to run a PS script to add a VPN connection through Intune PowerShell.

When the script is run directly in powershell it executes as it should, adding the VPN connection.

On the other hand, if it executes through Intune PowerShell, nothing happens. I've searched the intune logs on targeted user's PC and also the online Intune portal where the script has a: Succeeded status.

 

Am I doing something wrong?

 

5 Replies
Highlighted
Hi Nikola, what settings have used in the PowerShell policy...
Highlighted

@neilcarden Add-VpnConnection

Highlighted

@Nikola Nenadovic 

 

Apologies, I meant here:

 

Capture.PNG

 

Highlighted

@neilcardenI've used the same settings as on your image

Highlighted

@Nikola NenadovicTry setting "Run script in 64 bit PowerShell host (when available)" to "Yes". I have found some very strange behavior when the scripts run within the 32-bit emulator. Things like, registry setting changes that only affect that Powershell session.