get-scsmobject

Jun 12, 2012 at 2:46 PM

I am creating a test/dev environment for SCSM 2012 and only wanted to bring in a subset of users through the AD Connector.  Unfortunately I pulled in 230,000 users and it has overwhelmed my test box. 

I've deleted the connector and now I'm trying to remove the users via Powershell. I found this link:

http://smlets.codeplex.com/discussions/223385

and it provides this command:

get-scsmobject Microsoft.AD.User$ -Filter "Firstname -eq 'Phil'" | remove-scsmobject -whatif

which seems to be exactly what i want to do. Unfortunately I'm getting this error:

Get-SCSMObject : Cannot bind parameter 'Id'. Cannot convert value "Microsoft.AD.User$" to type "System.Guid". Error: "G
uid should contain 32 digits with 4 dashes (xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx)."
At line:1 char:15
+ get-scsmobject <<<<  Microsoft.AD.User$ -Filter "Firstname -eq 'Phil'" | remove-scsmobject -whatif
    + CategoryInfo          : InvalidArgument: (:) [Get-SCSMObject], ParameterBindingException
    + FullyQualifiedErrorId : CannotConvertArgumentNoMessage,SMLets.GetSMObjectCommand


I'm pretty new to powershell so any help would be appreciated.
Thanks.
Jun 13, 2012 at 7:47 AM
Edited Jun 13, 2012 at 7:48 AM

Hi mate,

try this one:

$UserClass = get-scsmclass -Name Microsoft.AD.User$
get-scsmobject -class $UserClass -Filter "Firstname -eq 'Phil'" | remove-scsmobject -whatif

Regards

Alex