/\/\o\/\/ PowerShelled

This blog has moved to http://ThePowerShellGuy.com Greetings /\/\o\/\/
$AtomFeed = ("Atom.xml")
$PreviousItems = (" PowerShell : WMI Support in RC2 (Series part 2) "," PowerShell : WMI Support in RC2 (Series part 1) "," PowerShell RC2 and Active Directory Part 2 "," PowerShell : Hosting IronPython "," PowerShell RC2 and Active Directory "," PowerShell : Using IronPython to Connect to AD and... "," PowerShell Session video of Bruce Payette "," PowerShell : Active Directory Part 11 - moving - R... "," PowerShell : Learn about the HashTable Object and ... "," PowerShell : Setting SendAs permission in Exchange... "," ")

Wednesday, October 11, 2006

 


PowerShell : WMI Support in RC2 : Privileges and connection settings (Series part 3)



  For some actions in WMI you need to enable privileges , for example for the SetDateTime method of win32_operatingsystem,

and how you can use the GUI again to edit settings, and change Classes , and also see posible values of properties also with the searcher you can do the same as we did see in (" PowerShell : WMI Support in RC2 (Series part 2) "," PowerShell : WMI Support in RC2 (Series part 1) ","

[WmiSearcher]$roq | opg

as I did get a question by G/\/\E  on the second part of this series, I did this quick post about this *Remark* I did not see the blog item he did make about this, about this when I started this

to see about that strange timeformat see second example, More information about calling methods in next post

PoSH>$win32_Operatingsystem = gwmi win32_Operatingsystem
PoSH>$win32_Operatingsystem.SetDateTime("20061010234615.000000+120")
Exception calling "SetDateTime" : "Access denied "
At line:1 char:35
+ $win32_Operatingsystem.SetDateTime( <<<< "20061010234615.000000+120")
PoSH>
$win32_Operatingsystem.psbase.Scope

IsConnected Options Path
----------- ------- ----
True System.Management.ConnectionOptions \\localhost\root\cimv2

PoSH>$win32_Operatingsystem.psbase.Scope.options

Locale :
Username :
Password :
Authority :
Impersonation : Impersonate
Authentication : Unchanged
EnablePrivileges : False
Context : {}
Timeout : 10675199.02:48:05.4775807

 

 

PoSH>$win32_Operatingsystem.psbase.Scope.options.EnablePrivileges = $true
PoSH>$win32_Operatingsystem.SetDateTime("20061010234615.000000+120")

__GENUS : 2
__CLASS : __PARAMETERS
__SUPERCLASS :
__DYNASTY : __PARAMETERS
__RELPATH :
__PROPERTY_COUNT : 1
__DERIVATION : {}
__SERVER :
__NAMESPACE :
__PATH :
ReturnValue : 0

Here you can see that you can also use the out-PropertyGrid to Edit and test those Settings as I showed in former posts about queries (Change properties and query will be automatically changed), *Note* you need to change to WmiClass eg to win32_share and back Note the changing of paths in the GUI, to reconnect and enable the privileges, note that you have a complete WMI browsel like this,

also I show the use of a added utility property added to a WMI class in RC2  to get a WMI dateTime, a bit more about methods in next post

PoSH>$win32_Operatingsystem = gwmi win32_Operatingsystem

PoSH>$win32_Operatingsystem.ConvertfromDateTime("10/10/2006 23:26:15")
20061010232615.000000+120

 

PoSH>$win32_Operatingsystem.SetDateTime("20061010232615.000000+120")
Exception calling "SetDateTime" : "Access denied "
At line:1 char:35
+ $win32_Operatingsystem.SetDateTime( <<<< "20061010232615.000000+120")

PoSH>$win32_Operatingsystem | opg
Cancel

PoSH>$win32_Operatingsystem | opg
Cancel

 



PoSH>$win32_Operatingsystem.SetDateTime("20061010232615.000000+120")

__GENUS : 2
__CLASS : __PARAMETERS
__SUPERCLASS :
__DYNASTY : __PARAMETERS
__RELPATH :
__PROPERTY_COUNT : 1
__DERIVATION : {}
__SERVER :
__NAMESPACE :
__PATH :
ReturnValue : 0

Enjoy,

Greetings, /\/\o\/\/

Tags : Monad PowerShell




Comments:
Anonymous Mjolinor
Thanks for all the work you do. I've been working using PS and WMI for network managment at work whenever I can, but I've hit a block trying to get to the MicrosoftIISV2 namespace. There is an authentication level that you have to set to secure the communication in order to access this namespace on a remote computer. I found an example of how to do this in VB, but don't know it well enough to translate to PS.
 
Post a Comment

Links to this post:

Create a Link



<< 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?