microsoftgraph / powershell-intune-samples

This repository of PowerShell sample scripts show how to access Intune service resources. They demonstrate this by making HTTPS RESTful API requests to the Microsoft Graph API from PowerShell.
MIT License
1.37k stars 659 forks source link

error while trying to run MacOS_MDATP_Deployment_Add_Assign.ps1 #160

Closed spalnitkar closed 3 years ago

spalnitkar commented 3 years ago

I am encountering an error when I try to run the above script for MacOS MDATP deployment.

The error is: ParserError: C:\intune\MacOS_MDATP_Deployment_Add_Assign.ps1:197 Line | 197 | … ata-ga-click="(Logged out) Header, go to Features">Features <span cla … | ~ | The '<' operator is reserved for future use.

I am using the latest Powershell (64) version 7; according the the documentation, the first time the script is run if should prompt for credentials to log in to the tenant; however I get the above error and cannot proceed.

davefalkus commented 3 years ago

Hi @spalnitkar,

Can you test using powershell 5.0, the pre-reqs in the readme list PS v5.0, scripts haven't been tested with PS.

PowerShell v5.0 on Windows 10 x64 (PowerShell v4.0 is a minimum requirement for the scripts to function correctly)

Dave

spalnitkar commented 3 years ago

Thank you so much for the prompt response:

I tried it with powershell 5 and go the following errors:

PS C:\tools\m365\scripts\Intune\MacOS\intune> .\MacOS_MDATP_Deployment_Add.ps1 -OnboardingXMLFilePath 'C:\tools\m365\scripts\Intune\MacOS\intune\WindowsDefenderATPOnboarding.xml' At C:\tools\m365\scripts\Intune\MacOS\intune\MacOS_MDATP_Deployment_Add.ps1:170 char:21

davefalkus commented 3 years ago

Hi @spalnitkar,

How are you creating the script, are you copying the raw content from github?

https://raw.githubusercontent.com/microsoftgraph/powershell-intune-samples/master/MDATP/MacOS_MDATP_Deployment_Add.ps1

Looks like your getting invalid characters on the download, so would be good to know how your getting the script locally.

Thanks

Dave

spalnitkar commented 3 years ago

Hi @davefalkus

I am using Microsoft Edge and right-clicking the script name and selecting "Save Link As" to download it to my local machine.

Thanks,

Sanjay

spalnitkar commented 3 years ago

Hi @davefalkus,

Thank you so much for the pointer; copying and pasting the raw content and creating the file seems to work.

Thanks,

Sanjay

davefalkus commented 3 years ago

If I repro the "Save Link As" then I get the HTML output

image

Could you open the link below: https://raw.githubusercontent.com/microsoftgraph/powershell-intune-samples/master/MDATP/MacOS_MDATP_Deployment_Add.ps1

Select All text then copy and create a ps1 script and retest?

Thanks

Dave

spalnitkar commented 3 years ago

@davefalkus, yes it works when I do that. Thanks again for your prompt replies.

davefalkus commented 3 years ago

Thanks @spalnitkar, happy to help.

Will close the issue.

Dave