top of page
Search

Remediation Script to Detect & Delete IT Admin Account

May 28, 2024
2 min read

Updated: Jan 12


If you want to create a Remediation Script for detecting and removing an account with Microsoft Intune, you can proceed by following these instructions:


  1. Sign in to the Microsoft Endpoint Manager admin center:

  1. Navigate to Endpoint security:

  • In the Microsoft Endpoint Manager admin center, go to "Devices" > "Scripts & Remediations" > "+ Create.

3. Basics:

  • Enter the Policy Name and click Next.

 


4. Settings:

  • Follow the below steps.

  1. Select detection script file.

  2. Select remediation script file.

  3. Run this script using the logged-on credentials: Yes

  4. Enforce script signature check: No

  5. Run script in 64-bit PowerShell: Yes

  6. Click next.



5. Assign the policy:

  • After configuring the policy, proceed to assign it to the appropriate groups within your organization.

  • You can choose to assign it to all devices, specific groups, or all users based on your organizational needs.



6. Review and create:

  • Review the settings you've configured to ensure they align with your organization's security policies.

  • Once you're satisfied, click "Create" to create the Remediation policy.



7. Monitor and troubleshoot:

  • After the policy is created and assigned, monitor its deployment to ensure its effectively giving you the results as needed.

  • If any issues arise, use the Intune console to troubleshoot and make necessary adjustments to the policy.



Script for Remediation to Identify and Remove Local IT Account.


1.               Script to Detect Local IT Account

 

$userName = "ITS"

$Userexist = (Get-LocalUser).Name -Contains $userName

if ($userexist) {  

Write-Host "$userName exist"  

Exit 1

Else { 

Write-Host "$userName does not exist" 

Exit 0

}

 

2.        Script to Delete Local IT Account


$userName = "ITS"

$userexist = (Get-LocalUser).Name -Contains $userName

if($userexist) { 

try{     

Remove-LocalUser -Name $username    

Exit 0  

}    

Catch {    

Write-error $_    

Exit 1  

}

}



 
 
 

Comments

Rated 0 out of 5 stars.
No ratings yet

Add a rating

Disclaimer: The above content is created at Tek-Doyen's sole discretion. Razorpay shall not be liable for any content provided here and shall not be responsible for any claims and liability that may arise due to merchant’s non-adherence to it.

bottom of page