I'm wondering if it's possible to run a powershell script from AD Users and Computers context menu. I have the Menu entry created, but it doesn't appear to execute the script. I don't know if it's something in my script or if it's something in the way I setup the DisplaySpecifier. I'm just trying to right click on a user and run through a process of finding a network folder, based on their name, and deleting it.
Here is my DisplaySpecifier Entry:
2,&Clear Drives,\\domain.local\netlogon\Clear-Drives.ps1
Code:
Param($username)
$Path = "\\Domain.local\users\$username"
If(Test-Path $Path){
remove-Item -path $path -force | out-Null
}It doesn't appear to be rocket science, but I'm definitely missing something.