powershellcommand-lineintune

AnyDesk CMD to PS1


Im trying to convert this to a .ps1 so i can run with intune, however cant seem to get it to work right.

Any ideas?

@echo off
cmd for /f "delims=" %%i in ('"C:\Program Files (x86)\AnyDeskMSI\AnyDeskMSI.exe" --get-id') do set ID=%%i 
echo AnyDesk ID is: %ID%
pause

The idea is it will put the ID, after that i can manipulate it no worries


Solution

  • Try this:

    & 'C:\Program Files (x86)\AnyDeskMSI\AnyDeskMSI.exe' --get-id | ForEach-Object { Write-Host $_ }