This blog has moved to http://ThePowerShellGuy.com
Greetings /\/\o\/\/
I got some help from the newsgroup on My CurrentPrincipal problem.
(thx, again William)
so now I can use GiveOwner to do a TakeOwner.
See Also :
the Principal Problem :
playing with MY-object from MSH the Get / set Owner Methods :
Update-TypeData (Democracy to the types) I pasted the newsgrouppost, below
gr /\/\o\/\/
William Stacey [MVP] wrote:
> I believe you need to set the principle policy to WindowsPrinciple first,
> otherwise you get a GenericPrinciple by default:
> > AppDomain myDomain = Thread.GetDomain();
> myDomain.SetPrincipalPolicy(PrincipalPolicy.WindowsPrincipal);
> WindowsPrincipal myPrincipal = >(WindowsPrincipal)Thread.CurrentPrincipal;>
Great !it works :
MSH > $d = [system.threading.thread]::getdomain()
MSH > $d.SetPrincipalPolicy([ System.Security.Principal.PrincipalPolicy]::WindowsPrincipal)
MSH > $p = [system.threading.thread]::currentPrincipal
MSH > $u = $p.identity.get_user()
MSH > (gi test.txt).get_owner()
Value-----BUILTIN\Administrators
MSH> (gi test.txt).set_owner($U)
MSH> (gi test.txt).Get_owner()
Value-----MyPuter\mow
thank You
gr /\/\o\/\/