/\/\o\/\/ PowerShelled

This blog has moved to http://ThePowerShellGuy.com Greetings /\/\o\/\/
$AtomFeed = ("Atom.xml")
$PreviousItems = (" MSH Clipboard use workaround "," [MSH] keyboard status "," playing with MY-object from MSH "," MSH access NT provider "," Update-TypeData (Democracy to the types) "," MSH directory watcher with popup-balloon "," StartRDP script "," convert images in MSH "," Style Problems "," ColorCoding MSH scripts on blog "," ")

Sunday, October 23, 2005

 


MSH TakeOwner working



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\/\/


Comments:
Anonymous Anonymous
This comment has been removed by a blog administrator.
 
Post a Comment



<< Home

Archives

October 2005   November 2005   December 2005   January 2006   February 2006   March 2006   April 2006   May 2006   June 2006   July 2006   August 2006   September 2006   October 2006   November 2006   December 2006  

$Links = ("PowerShell RC1 Docs"," PowerShell RC1 X86"," PowerShell RC1 X64"," Monad GettingStarted guide"," Monad Progamming Guide"," Monad SDK"," Monad videos on Channel 9"," MSH Community Workspace"," scripts.readify.net "," MonadSource"," www.reskit.net"," PowerShell Blog"," Under The Stairs"," computerperformance powershell Home"," proudlyserving"," MSH on wikipedia"," MSHWiki Channel 9"," Keith Hill's Blog"," Precision Computing"," PowerShell for fun"," MSH Memo (Japanese)"," monadblog")

find-blog -about "PowerShell","Monad" | out-Technorati.
find-blog -contains "","" | out-Technorati.
Google
 
Web mow001.blogspot.com

This page is powered by Blogger. Isn't yours?