by Nobody at 2013-03-27 15:52:53
I created a script to delete profiles on remote computers using the Delete() method of the WMI Object, however Get-Member does not show the delete method. I know it works, but short of someone telling it’s there, how would I otherwise know(see) that the delete method is available? This also seems to be the case for deleting printers and I assume other WMI Classes.by DexterPOSH at 2013-03-27 16:08:26
get-wmiobject -query "SELECT * from win32_userprofile WHERE LocalPath LIKE
If you hit up the documentation for the class Win32_UserProfile on MSDN.by proxb at 2013-03-27 18:16:46
similarly for Win32_Printer class:
I don’t see the delete method here too.
Try this to view the Delete() method.by Nobody at 2013-03-28 10:42:26
(gwmi win32_userprofile).psbase | gm
Thanks!by DexterPOSH at 2013-03-29 11:21:21
[quote=“proxb”]by Nobody at 2013-03-29 12:04:10
(gwmi win32_userprofile).psbase | gm[/quote]
Ok, this method comes wrapped on the PSbase…I need to study up this.
This article summed up psbase up pretty well for me. I feel like I graduated PS kindergarten nowby DexterPOSH at 2013-03-29 16:38:16
http://blogs.technet.com/b/heyscripting … group.aspx
Yet another good question: what the heck is that PSBase stuff? Well, when you use Windows PowerShell to connect to an object, PowerShell will often decide, in advance, which methods and properties will be exposed to you. Thatâ€™s usually fine, except that sometimes PowerShell guesses wrong; sometimes it fails to show the property or method you really need. Thatâ€™s the case here; if you bind to a local group account (like the Administrator account) PowerShell exposes only a handful of methods and properties:
Thatâ€™s where the PSBase object comes in. PSBase lets you get at the â€œrawâ€ object behind the object PowerShell exposes by default; in other words, PSBase lets you get at all the properties and methods of the object:
[quote=“Nobody”]This article summed up psbase up pretty well for me. I feel like I graduated PS kindergarten now
http://blogs.technet.com/b/heyscripting … group.aspx[/quote]
Scripting Guy’s blog is the first place to start obviously
Not much of a surprise, but that article was amongst one I had lined up to read.
Thanks for sharing it.