This blog has moved to http://ThePowerShellGuy.com
Greetings /\/\o\/\/
Just some Com hacks in MSH I think are nice :
*edit* I keep on forgetting, you will need this alias, or change the new to new-object,
set-alias new new-object# Some COM hacks
# local user management
MSH>(new -com shell.users).create('foo')
isLoggedOn : False
passwordRequired : False
interactiveLogonAllowed : True
isProfilePrivate :
isPasswordResetAvailable : False
MSH>(new -com shell.users).item('foo').changePassword('Secret','')
True
MSH>(new -com shell.users).item('foo')
isLoggedOn : False
passwordRequired : True
interactiveLogonAllowed : True
isProfilePrivate :
isPasswordResetAvailable : False
MSH>(new -com shell.users).remove('foo')
True
MSH>(new -com shell.users).item('foo')
Exception calling "item" with "1" argument(s): "The parameter is
incorrect. (Exception from HRESULT: 0x80070057 (E_INVALIDARG))"
At line:1 char:28
# File Dialog
$c = new -com UserAccounts.CommonDialog
MSH>$c.ShowOpen()
True
MSH>$c
Filter :
FilterIndex : 0
FileName : C:\Documents and Settings\mow\My
Documents\msh_transcript.20051129213303.txt
Flags : 0
Owner :
InitialDir :
# Make a CAB file
$m = new -com makecab.makecab
$m.CreateCab('c:\mow.cab',$false,$false,!-1)
$m.addfile('c:\test.txt','test.txt')
$m.CloseCab()
enjoy,
gr /\/\o\/\/
Tags : Monad msh