Forums on Intune, SCCM, and Windows 11

Welcome to the forums. Register a free account today to become a member! Once signed in, you'll be able to participate on this site by adding your topics and posts, as well as connect with other members through your own private inbox!

PENDING task sequence - remove autopilot with powershell

  • Thread starter Thread starter ctr2020
  • Start date Start date
  • Replies Replies 1
  • Views Views 777

ctr2020

New Member
Messages
2
Reaction score
0
Points
1
I created a sequence task to remove a PC from our inventory, it reinstalls the PC, delete the BIOS password and uninstalls the MECM client.
But today I need to remove the autopilot pc.
I have a powershell script that works with api graph from my PC.

Except that from my TS, it doesn't work.

All messages ares :
PackageManagementInstall-Package : No match found for specified search criteria and name RunPowerShellScript 27/11/2023 13:38:14 5264 (0x1490)
of the WindowsAutopilotIntune module. Use Get-PSRepository to display all available registered RunPowerShellScript 27/11/2023 13:38:14 5264 (0x1490)
available repositories. RunPowerShellScript 27/11/2023 13:38:14 5264 (0x1490)
At character C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\1.0.0.1\PSModule.psm1:1809 : 21 RunPowerShellScript 27/11/2023 13:38:14 5264 (0x1490)
+ ... $null = PackageManagement\Install-Package @PSBoundParameters RunPowerShellScript 27/11/2023 13:38:14 5264 (0x1490)
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ RunPowerShellScript 27/11/2023 13:38:14 5264 (0x1490)
+ CategoryInfo : ObjectNotFound: (Microsoft.Power....InstallPackage:InstallPackage) [Install-Package], Ex RunPowerShellScript 27/11/2023 13:38:14 5264 (0x1490)
ception RunPowerShellScript 27/11/2023 13:38:14 5264 (0x1490)
+ FullyQualifiedErrorId : NoMatchFoundForCriteria,Microsoft.PowerShell.PackageManagement.Cmdlets.InstallPackage RunPowerShellScript 27/11/2023 13:38:14 5264 (0x1490)

here is the beginning of the script :
Set-ExecutionPolicy Unrestricted -Force
Install-Module -Name Microsoft.Graph.DeviceManagement.Enrollment -Force
Import-Module -Name Microsoft.Graph.DeviceManagement.Enrollment

what do I have to do to make it work?
 
The message states that the PowerShell modules isn't installed.
 

Forum statistics

Threads
7,133
Messages
27,858
Members
18,151
Latest member
TonyGTR
Back
Top