Azure-Samples / TestDeviceRegConnectivity

MIT License
27 stars 12 forks source link

Stoops execution with Argument is NULL exception #7

Open Interface007 opened 1 year ago

Interface007 commented 1 year ago

Please provide us with the following information:

This issue is for a: (mark with an x)

- [x] bug report -> please search issues before submitting
- [ ] feature request
- [ ] documentation issue or request
- [ ] regression (a behavior that used to work and stopped in a new release)

Minimal steps to reproduce

run the script on a Win11 PC jopined to Azure AD

Any log messages given by the failure

===================================================== Test Device Registration Connectivity

Test-DeviceRegConnectivity log file has been created.

Testing Internet Connectivity... Checking winHTTP proxy settings... Access Type : PROXY Proxy Server List : DirectAccess (kein Proxyserver). Proxy Bypass List :

Checking winInet proxy settings... Proxy Enabled : No Proxy Server List : Proxy Bypass List : AutoConfigURL :

Testing Device Registration Endpoints... Testing connection via winHTTP proxy... Start-ScheduledTask : Das Argument für den Parameter "InputObject" kann nicht überprüft werden. Das Argument ist NULL oder leer. Geben Sie ein Argument an, das nicht NULL oder leer ist, und führen Sie den Befehl erneut aus. In C:\Users\matzensv\Downloads\TestDeviceRegConnectivity-main (1)\TestDeviceRegConnectivity-main\Test-DeviceRegConnectivity.ps1:26 Zeichen:13

  • $Task | Start-ScheduledTask -AsJob -ErrorAction Stop | Wait-Job | ...
  • 
    + CategoryInfo          : InvalidData: (:) [Start-ScheduledTask], ParameterBindingValidationException
    + FullyQualifiedErrorId : ParameterArgumentValidationError,Start-ScheduledTask

Expected/desired behavior

running smoothly without erropr messages

OS and Version?

Windows 11 Enterprise

Versions

what versions?

Mention any other details that might be useful

Register-ScheduledTask seems to simply return NULL in this case

Thanks! We'll be in touch soon.

samuxel commented 1 year ago

Hi. I experienced the same issue. When analysing the problem we found that when no proxies are active on the device you are executing the script from, it still enters the if conditions for proxies. Proxie addresses are then incorrectly translated.

Screenshot 2023-08-13 153420

With no active proxy the script still recognizes "-Proxy http://DirectAccess (kein Proxyserver)" as a proxy address. Under this condition the job creation and therefore, the task creation fails and you get the error that you are getting.

If you want to fix it yourself all you need to do is go to the following lines: 127,142 and 156 and replace "-Proxy $global:ProxyServer" with "-Proxy NoProxy"