Archive for September, 2011

Video: Jeffrey Snover – Proxy Functions

One of Microsoft’s goals with PowerShell is to give users the tools and capabilities to develop their own functionality so they never have to wait on Microsoft to deliver what they need.

In this video, recorded at The Experts Conference US 2011 PowerShell Deep Dive, Windows PowerShell inventor Jeffrey Snover shows you how to use PowerShell v2 proxy functions. To quote Jeffrey from the session abstract:

Proxy functions are one of my favorite V2 features because just as PowerShell gives you a crazy level of control over your environment, Proxy Functions give you a crazy level of control over your functions. Didn’t get what you wanted/needed in the PowerShell V2 cmdlets? Don’t wait to see if they get fixed in V3, take control of the situation with Proxy Functions. Add parameters, Remove parameters, tweak parameter attributes, add your own semantics and have a party doing it. If you don’t walk away thinking “who needs those PowerShell developers anymore”, you weren’t paying attention.

In case the screen is too hard to follow, here are:

And here’s the video recording:

This is a live recording from US TEC 2011 PowerShell Deep Dive conference. TEC Europe is just around the corner – October 17-19th, 2011 in FrankfurtRegister today to get a discount.

See also:

Advertisements

PowerPack for non-Windows management in SCCM and SCOM

Quest loves PowerShell and many Quest teams have implemented powershell interfaces to their IT management products – I from my side am obviously willing to promote and encourage these efforts.

Our Quest Management Xtensions team is in charge of over 400 (!) extensions to Microsoft Systems Center, letting you use Operations Manager, Configuration Manager, and Opalis with variety of non-Microsoft platforms.

And today I am excited to announce that this team released a PowerPack for their tool! So not only can you get more out of your Systems Center tools, you can also now get extensible alternative user interface to the tools, and can further automate various operations with PowerShell.

You can learn more about Management Xtensions and download them here, and the PowerPack here.

PowerShell v3 at BUILD Conference round-up

Now that all PowerShell sessions at Microsoft’s BUILD Windows conference are over, here’s my quick summary from the event from PowerShell perspective.

PowerShell was big in the session track of the conference. Even the server sessions which had nothing to do with PowerShell typically had PowerShell in demos when it came to server management tasks.

The biggest PowerShell highlight of the event was that Windows 8 ships with PowerShell v3 and the Windows server already has more than 2300 cmdlets in it!

Also, PowerShell v3 is not going to be a Windows 8 thing only. Jeffrey committed to shipping standalone PowerShell v3 setup for Windows 7 simultaneously with Windows 8, and a preview version of that Windows 7 setup might come as early as next week!

UPDATE: Here’s the Windows 7 / Server 2008 R2 CTP setup.

Below are the highlights of the sessions and links to the video recordings and slides.

Sessions by Jeffrey and Refaat:

Make your product manageable Make your product manageable – session on the new manageability options in PowerShell v3:

  • Now it is easier to write a WMI providers (for example skeleton is generated for you),
  • WMI provider van be automatically converted to cmdlets so you get -whatif, etc.,
  • Workflows are fully compatible with PowerShell and can be run directly from PowerShell, and PowerShell cmdlets can be used as Workflow activities,
  • PowerShell Web API – REST (OData) API to PowerShell cmdlets.


Manage a highly-efficient environment at scale using the Windows Management Framework (WMF)Manage a highly-efficient environment at scale using the Windows Management Framework (WMF):

  • New interfaces for CIM/WMI,
  • Improvements in remoting,
  • Workflows and cmdlets + suspend/resume and ability to survive reboots,
  • Multiple improvements in PowerShell jobs including native support for jobs as Windows Scheduled Tasks,
  • NanoWBEM – Microsoft’s Linux (!) component to make non-Windows and devices manageable from PowerShell.

Sessions featuring Jeffrey:

Windows Server 8 track keynote – Jeffrey Snover gives a demo on multi-machine management around 30 minutes into the session:

Windows Server 8

Windows Server 8 apps must run without a GUI  – great session on Server Core improvements with Jeffrey providing the big picture on it and PowerShell role in this set up:

Windows Server 8 apps must run without a GUI - learn more now

Video: Richard Siddaway – WMI: Gems and Gotchas

Another great recording from US TEC 2011 PowerShell Deep Dive – Richard’s session on WMI in PowerShell. Richard has written an entire book on that topic so he is probably one of the best experts in the area.

Abstract: “WMI has been part of the Windows environment for a long time, and has a reputation for being very powerful but very difficult. PowerShell has made WMI easier to use, but the interaction between the two is still relatively undocumented. PowerShell has also opened WMI up in a number of ways but introduces a number of “gotchas” in the process. This US Experts Conference 2011 PowerShell Deep Dive session demonstrates that that any “gotchas” can be overvcome and WMI offers a treasure trove of functionality to the administrator. The video also answers a number of key questions about WMI and PowerShell, including:

• Is Invoke-WmiMethod always the answer?
• How can I change WMI information?
• How does WMI authentication and authorisation work?
• Should I use explicit remoting, implicit remoting or WMI?
• WMI overlaps with some cmdlets e.g. Get-Process and Win32_Process — which should I use when?
• How do I get the best of WQL? Do I use queries or filters?

Slides: Slides-TEC-2011-Richard-Siddaway-WMI-Gems-and-Gotchas

Scripts: Scripts-TEC-2011-Richard-Siddaway-WMI-Gems-and-Gotchas

Video:

This is a live recording from US TEC 2011 PowerShell Deep Dive conference. TEC Europe is just around the corner – October 17-19th, 2011 in FrankfurtRegister today to get a discount.

See also:

First Glimpse at PowerShell v3

I finally got a hold of Windows 8 laptop (thank you Microsoft!), connected a keyboard, launched PowerShell and here are the first few results before I run to the dinner. 😉

First off, let’s check the version:

PS C:\> $host.Version

Major  Minor  Build  Revision
-----  -----  -----  --------
3      0      -1     -1

So far so good…

When I tried to get all modules, at some point the operation failed but a lot still got added:

PS C:\> (Get-Module -All).count
234
PS C:\> (Get-Module -ListAvailable).count
44

A lot of the modules though seem to be automatically generated from CIM classes:

PS C:\> Get-Module -All

ModuleType Name                      ExportedCommands
---------- ----                      ----------------
Manifest   AppLocker                 {Get-AppLockerFileInformation, Get-AppLockerPolicy, New-AppLockerPolicy,...
Script     Appx                      Get-AppxLastError
Binary     Appx                      {Add-AppxPackage, Get-AppxPackage, Get-AppxPackageManifest, Remove-AppxP...
Script     BitLocker                 {Add-BitLockerKeyProtector, Add-BitLockerPassphraseProtector, Add-BitLoc...
Manifest   BitsTransfer              {Add-BitsFile, Complete-BitsTransfer, Get-BitsTransfer, Remove-BitsTrans...
Manifest   BranchCache               {Add-BCDataCacheExtension, Clear-BCCache, Disable-BC, Disable-BCDowngrad...
Cim        BranchCacheClientSetti... Get-BCClientSettings
Cim        BranchCacheContentServ... Get-BCContentServerSettings
Cim        BranchCacheHostedCache... Get-BCHostedCacheServerSettings
Cim        BranchCacheNetworkSett... Get-BCNetworkSettings
Cim        BranchCacheOrchestrator   {Add-BCDataCacheExtension, Clear-BCCache, Disable-BC, Disable-BCDowngrad...
Cim        BranchCachePrimaryPubl... Get-BCHashCache
Cim        BranchCachePrimaryRepu... Get-BCDataCache
Cim        BranchCacheSecondaryRe... Get-BCDataCacheExtension
Cim        BranchCacheStatus         Get-BCStatus
Manifest   CimCmdlets                {Get-CimAssociatedInstance, Get-CimClass, Get-CimInstance, Get-CimSessio...
Manifest   DirectAccessClientComp... {Disable-DAManualSiteSelection, Enable-DAManualSiteSelection, Get-DAClie...
Cim        Disk                      {Clear-Disk, Get-Disk, Initialize-Disk, New-Partition...}
Script     Dism                      {Add-Driver, Add-Package, Add-ProvisionedAppxPackage, Clear-CorruptMount...
Manifest   DnsClient                 {Resolve-DnsName, Add-DnsClientNrptRule, Clear-DNSClientCache, Get-DNSCl...
Manifest   DnsConfig                 {Clear-DNSClientCache, Get-DNSClient, Get-DNSClientCache, Get-DNSGlobalS...
Binary     DnsLookup                 Resolve-DnsName
Manifest   DnsNrpt                   {Add-DnsClientNrptRule, Get-DnsClientEffectiveNrptPolicy, Get-DnsClientN...
Cim        InitiatorId               {Get-InitiatorId, Remove-InitiatorId}
Cim        InitiatorPort             {Get-InitiatorPort, Set-InitiatorPort}
Manifest   iSCSI                     {Connect-IscsiDiscoveredTarget, Disconnect-IscsiDiscoveredTarget, Get-Is...
Cim        iSCSIConnection           Get-IscsiConnection
Cim        iSCSIDiscoveredTarget     {Connect-IscsiDiscoveredTarget, Disconnect-IscsiDiscoveredTarget, Get-Is...
Cim        iSCSIInitiator            Set-IscsiInitiator
Cim        iSCSIPersistentTarget     {Get-IscsiPersistentTarget, Register-IscsiPersistentTarget, Unregister-I...
Cim        iSCSISession              Get-IscsiSession
Cim        iSCSITargetPortal         {Get-IscsiTargetPortal, New-IscsiTargetPortal, Remove-IscsiTargetPortal,...

Looking at the standard PowerShell modules we get:

PS C:\> Get-Module Microsoft.PowerShell.*

ModuleType Name                      ExportedCommands
---------- ----                      ----------------
Manifest   Microsoft.PowerShell.Core {Add-History, Add-PSSnapin, Clear-History, Connect-PSSession...}
Manifest   Microsoft.PowerShell.D... {Export-Counter, Get-Counter, Get-WinEvent, Import-Counter...}
Manifest   Microsoft.PowerShell.Host {Start-Transcript, Stop-Transcript}
Manifest   Microsoft.PowerShell.M... {Add-Computer, Add-Content, Checkpoint-Computer, Clear-Content...}
Manifest   Microsoft.PowerShell.S... {ConvertFrom-SecureString, ConvertTo-SecureString, Get-Acl, Get-Authenti...
Manifest   Microsoft.PowerShell.U... {Add-Member, Add-Type, Clear-Variable, Compare-Object...}
PS C:\> (get-command -Module Microsoft.PowerShell.*).count
248

Here’s a quick list of all the standard cmdlets in the box at the moment:

PS C:\> get-command -Module Microsoft.PowerShell.* | sort module, noun | format-table ModuleName, Name -AutoSize

ModuleName                       Name
----------                       ----
Microsoft.PowerShell.Core        Invoke-Command
Microsoft.PowerShell.Core        Get-Command
Microsoft.PowerShell.Core        Export-Console
Microsoft.PowerShell.Core        Out-Default
Microsoft.PowerShell.Core        Save-Help
Microsoft.PowerShell.Core        Get-Help
Microsoft.PowerShell.Core        Update-Help
Microsoft.PowerShell.Core        Add-History
Microsoft.PowerShell.Core        Invoke-History
Microsoft.PowerShell.Core        Clear-History
Microsoft.PowerShell.Core        Get-History
Microsoft.PowerShell.Core        Out-Host
Microsoft.PowerShell.Core        Get-Job
Microsoft.PowerShell.Core        Suspend-Job
Microsoft.PowerShell.Core        Stop-Job
Microsoft.PowerShell.Core        Receive-Job
Microsoft.PowerShell.Core        Wait-Job
Microsoft.PowerShell.Core        Resume-Job
Microsoft.PowerShell.Core        Start-Job
Microsoft.PowerShell.Core        Remove-Job
Microsoft.PowerShell.Core        Register-JobEvent
Microsoft.PowerShell.Core        Import-Module
Microsoft.PowerShell.Core        New-Module
Microsoft.PowerShell.Core        Get-Module
Microsoft.PowerShell.Core        Remove-Module
Microsoft.PowerShell.Core        Test-ModuleManifest
Microsoft.PowerShell.Core        New-ModuleManifest
Microsoft.PowerShell.Core        Export-ModuleMember
Microsoft.PowerShell.Core        Out-Null
Microsoft.PowerShell.Core        ForEach-Object
Microsoft.PowerShell.Core        Where-Object
Microsoft.PowerShell.Core        Set-PSDebug
Microsoft.PowerShell.Core        Enable-PSRemoting
Microsoft.PowerShell.Core        Disable-PSRemoting
Microsoft.PowerShell.Core        Get-PSSession
Microsoft.PowerShell.Core        Enter-PSSession
Microsoft.PowerShell.Core        Exit-PSSession
Microsoft.PowerShell.Core        New-PSSession
Microsoft.PowerShell.Core        Remove-PSSession
Microsoft.PowerShell.Core        Connect-PSSession
Microsoft.PowerShell.Core        Receive-PSSession
Microsoft.PowerShell.Core        Disconnect-PSSession
Microsoft.PowerShell.Core        Register-PSSessionConfiguration
Microsoft.PowerShell.Core        Disable-PSSessionConfiguration
Microsoft.PowerShell.Core        Unregister-PSSessionConfiguration
Microsoft.PowerShell.Core        Set-PSSessionConfiguration
Microsoft.PowerShell.Core        Get-PSSessionConfiguration
Microsoft.PowerShell.Core        Enable-PSSessionConfiguration
Microsoft.PowerShell.Core        Test-PSSessionConfigurationFile
Microsoft.PowerShell.Core        New-PSSessionConfigurationFile
Microsoft.PowerShell.Core        New-PSSessionOption
Microsoft.PowerShell.Core        Add-PSSnapin
Microsoft.PowerShell.Core        Remove-PSSnapin
Microsoft.PowerShell.Core        Get-PSSnapin
Microsoft.PowerShell.Core        New-PSTransportOption
Microsoft.PowerShell.Core        Set-StrictMode
Microsoft.PowerShell.Diagnostics Get-Counter
Microsoft.PowerShell.Diagnostics Import-Counter
Microsoft.PowerShell.Diagnostics Export-Counter
Microsoft.PowerShell.Diagnostics Get-WinEvent
Microsoft.PowerShell.Diagnostics New-WinEvent
Microsoft.PowerShell.Host        Start-Transcript
Microsoft.PowerShell.Host        Stop-Transcript
Microsoft.PowerShell.Management  Get-ChildItem
Microsoft.PowerShell.Management  Export-CimCommand
Microsoft.PowerShell.Management  Stop-Computer
Microsoft.PowerShell.Management  Checkpoint-Computer
Microsoft.PowerShell.Management  Add-Computer
Microsoft.PowerShell.Management  Restore-Computer
Microsoft.PowerShell.Management  Remove-Computer
Microsoft.PowerShell.Management  Rename-Computer
Microsoft.PowerShell.Management  Restart-Computer
Microsoft.PowerShell.Management  Reset-ComputerMachinePassword
Microsoft.PowerShell.Management  Enable-ComputerRestore
Microsoft.PowerShell.Management  Disable-ComputerRestore
Microsoft.PowerShell.Management  Get-ComputerRestorePoint
Microsoft.PowerShell.Management  Test-ComputerSecureChannel
Microsoft.PowerShell.Management  Test-Connection
Microsoft.PowerShell.Management  Add-Content
Microsoft.PowerShell.Management  Get-Content
Microsoft.PowerShell.Management  Clear-Content
Microsoft.PowerShell.Management  Set-Content
Microsoft.PowerShell.Management  Show-ControlPanelItem
Microsoft.PowerShell.Management  Get-ControlPanelItem
Microsoft.PowerShell.Management  Write-EventLog
Microsoft.PowerShell.Management  New-EventLog
Microsoft.PowerShell.Management  Limit-EventLog
Microsoft.PowerShell.Management  Remove-EventLog
Microsoft.PowerShell.Management  Show-EventLog
Microsoft.PowerShell.Management  Get-EventLog
Microsoft.PowerShell.Management  Clear-EventLog
Microsoft.PowerShell.Management  Get-HotFix
Microsoft.PowerShell.Management  Move-Item
Microsoft.PowerShell.Management  Invoke-Item
Microsoft.PowerShell.Management  Rename-Item
Microsoft.PowerShell.Management  Copy-Item
Microsoft.PowerShell.Management  Get-Item
Microsoft.PowerShell.Management  Remove-Item
Microsoft.PowerShell.Management  Set-Item
Microsoft.PowerShell.Management  New-Item
Microsoft.PowerShell.Management  Clear-Item
Microsoft.PowerShell.Management  Remove-ItemProperty
Microsoft.PowerShell.Management  New-ItemProperty
Microsoft.PowerShell.Management  Get-ItemProperty
Microsoft.PowerShell.Management  Move-ItemProperty
Microsoft.PowerShell.Management  Clear-ItemProperty
Microsoft.PowerShell.Management  Copy-ItemProperty
Microsoft.PowerShell.Management  Rename-ItemProperty
Microsoft.PowerShell.Management  Set-ItemProperty
Microsoft.PowerShell.Management  Get-Location
Microsoft.PowerShell.Management  Set-Location
Microsoft.PowerShell.Management  Push-Location
Microsoft.PowerShell.Management  Pop-Location
Microsoft.PowerShell.Management  Convert-Path
Microsoft.PowerShell.Management  Resolve-Path
Microsoft.PowerShell.Management  Join-Path
Microsoft.PowerShell.Management  Split-Path
Microsoft.PowerShell.Management  Test-Path
Microsoft.PowerShell.Management  Wait-Process
Microsoft.PowerShell.Management  Get-Process
Microsoft.PowerShell.Management  Debug-Process
Microsoft.PowerShell.Management  Start-Process
Microsoft.PowerShell.Management  Stop-Process
Microsoft.PowerShell.Management  Get-PSDrive
Microsoft.PowerShell.Management  Remove-PSDrive
Microsoft.PowerShell.Management  New-PSDrive
Microsoft.PowerShell.Management  Get-PSProvider
Microsoft.PowerShell.Management  New-Service
Microsoft.PowerShell.Management  Set-Service
Microsoft.PowerShell.Management  Resume-Service
Microsoft.PowerShell.Management  Restart-Service
Microsoft.PowerShell.Management  Stop-Service
Microsoft.PowerShell.Management  Start-Service
Microsoft.PowerShell.Management  Get-Service
Microsoft.PowerShell.Management  Suspend-Service
Microsoft.PowerShell.Management  Start-Transaction
Microsoft.PowerShell.Management  Complete-Transaction
Microsoft.PowerShell.Management  Get-Transaction
Microsoft.PowerShell.Management  Use-Transaction
Microsoft.PowerShell.Management  Undo-Transaction
Microsoft.PowerShell.Management  New-WebServiceProxy
Microsoft.PowerShell.Management  Register-WmiEvent
Microsoft.PowerShell.Management  Set-WmiInstance
Microsoft.PowerShell.Management  Invoke-WmiMethod
Microsoft.PowerShell.Management  Remove-WmiObject
Microsoft.PowerShell.Management  Get-WmiObject
Microsoft.PowerShell.Security    Set-Acl
Microsoft.PowerShell.Security    Get-Acl
Microsoft.PowerShell.Security    Set-AuthentipreSignature
Microsoft.PowerShell.Security    Get-AuthentipreSignature
Microsoft.PowerShell.Security    Get-Credential
Microsoft.PowerShell.Security    Set-ExecutionPolicy
Microsoft.PowerShell.Security    Get-ExecutionPolicy
Microsoft.PowerShell.Security    Get-PfxCertificate
Microsoft.PowerShell.Security    ConvertTo-SecureString
Microsoft.PowerShell.Security    ConvertFrom-SecureString
Microsoft.PowerShell.Utility     Export-Alias
Microsoft.PowerShell.Utility     New-Alias
Microsoft.PowerShell.Utility     Import-Alias
Microsoft.PowerShell.Utility     Set-Alias
Microsoft.PowerShell.Utility     Get-Alias
Microsoft.PowerShell.Utility     Export-Clixml
Microsoft.PowerShell.Utility     Import-Clixml
Microsoft.PowerShell.Utility     Trace-Command
Microsoft.PowerShell.Utility     Show-Command
Microsoft.PowerShell.Utility     Measure-Command
Microsoft.PowerShell.Utility     ConvertTo-Csv
Microsoft.PowerShell.Utility     ConvertFrom-Csv
Microsoft.PowerShell.Utility     Export-Csv
Microsoft.PowerShell.Utility     Import-Csv
Microsoft.PowerShell.Utility     Get-Culture
Microsoft.PowerShell.Utility     Format-Custom
Microsoft.PowerShell.Utility     Get-Date
Microsoft.PowerShell.Utility     Set-Date
Microsoft.PowerShell.Utility     Write-Debug
Microsoft.PowerShell.Utility     Register-EngineEvent
Microsoft.PowerShell.Utility     Write-Error
Microsoft.PowerShell.Utility     Unregister-Event
Microsoft.PowerShell.Utility     Get-Event
Microsoft.PowerShell.Utility     New-Event
Microsoft.PowerShell.Utility     Wait-Event
Microsoft.PowerShell.Utility     Remove-Event
Microsoft.PowerShell.Utility     Get-EventSubscriber
Microsoft.PowerShell.Utility     Invoke-Expression
Microsoft.PowerShell.Utility     Unblock-File
Microsoft.PowerShell.Utility     Out-File
Microsoft.PowerShell.Utility     Get-FormatData
Microsoft.PowerShell.Utility     Export-FormatData
Microsoft.PowerShell.Utility     Update-FormatData
Microsoft.PowerShell.Utility     Out-GridView
Microsoft.PowerShell.Utility     Read-Host
Microsoft.PowerShell.Utility     Get-Host
Microsoft.PowerShell.Utility     Write-Host
Microsoft.PowerShell.Utility     ConvertTo-Html
Microsoft.PowerShell.Utility     ConvertFrom-Json
Microsoft.PowerShell.Utility     ConvertTo-Json
Microsoft.PowerShell.Utility     Format-List
Microsoft.PowerShell.Utility     Update-List
Microsoft.PowerShell.Utility     Import-LocalizedData
Microsoft.PowerShell.Utility     Send-MailMessage
Microsoft.PowerShell.Utility     Add-Member
Microsoft.PowerShell.Utility     Get-Member
Microsoft.PowerShell.Utility     Compare-Object
Microsoft.PowerShell.Utility     Tee-Object
Microsoft.PowerShell.Utility     New-Object
Microsoft.PowerShell.Utility     Measure-Object
Microsoft.PowerShell.Utility     Group-Object
Microsoft.PowerShell.Utility     Select-Object
Microsoft.PowerShell.Utility     Sort-Object
Microsoft.PowerShell.Utility     Register-ObjectEvent
Microsoft.PowerShell.Utility     Write-Output
Microsoft.PowerShell.Utility     Out-Printer
Microsoft.PowerShell.Utility     Write-Progress
Microsoft.PowerShell.Utility     Get-PSBreakpoint
Microsoft.PowerShell.Utility     Enable-PSBreakpoint
Microsoft.PowerShell.Utility     Disable-PSBreakpoint
Microsoft.PowerShell.Utility     Remove-PSBreakpoint
Microsoft.PowerShell.Utility     Set-PSBreakpoint
Microsoft.PowerShell.Utility     Get-PSCallStack
Microsoft.PowerShell.Utility     Export-PSSession
Microsoft.PowerShell.Utility     Import-PSSession
Microsoft.PowerShell.Utility     Get-Random
Microsoft.PowerShell.Utility     Invoke-RestMethod
Microsoft.PowerShell.Utility     Start-Sleep
Microsoft.PowerShell.Utility     Out-String
Microsoft.PowerShell.Utility     Select-String
Microsoft.PowerShell.Utility     ConvertFrom-StringData
Microsoft.PowerShell.Utility     Format-Table
Microsoft.PowerShell.Utility     New-TimeSpan
Microsoft.PowerShell.Utility     Get-TraceSource
Microsoft.PowerShell.Utility     Set-TraceSource
Microsoft.PowerShell.Utility     Add-Type
Microsoft.PowerShell.Utility     Update-TypeData
Microsoft.PowerShell.Utility     Remove-TypeData
Microsoft.PowerShell.Utility     Get-TypeData
Microsoft.PowerShell.Utility     Get-UICulture
Microsoft.PowerShell.Utility     Get-Unique
Microsoft.PowerShell.Utility     Get-Variable
Microsoft.PowerShell.Utility     Remove-Variable
Microsoft.PowerShell.Utility     New-Variable
Microsoft.PowerShell.Utility     Clear-Variable
Microsoft.PowerShell.Utility     Set-Variable
Microsoft.PowerShell.Utility     Write-Verbose
Microsoft.PowerShell.Utility     Write-Warning
Microsoft.PowerShell.Utility     Invoke-WebRequest
Microsoft.PowerShell.Utility     Format-Wide
Microsoft.PowerShell.Utility     Select-Xml
Microsoft.PowerShell.Utility     ConvertTo-Xml

To be continued… 😉

PowerGUI and AD cmdlets usergroup at Deep Dive?

If you are planning to attend European TEC 2011 PowerShell Deep Dive in Frankfurt October 17-18 2011, I have a question for you: would you like to stay half a day longer and have a usergroup for PowerGUI and QAD cmdlets in the morning of Oct 19th -or in the afternoon of Sunday, Oct 16th?

We could discuss the features and roadmap, share our experience with the tools, and so on.

Let me know if you are interested – if there’s enough people wanting to do that I can work with the organizers to get us the room, etc.

Group Membership Unions and Intersections

A friend of mine recently asked for one-liners for Active Directory group membership union and intersection.

These are the one-liners which I sent him:

Group Union – users present in either of the groups (he needed a list of DNs of direct members of two groups):

(Get-QADGroupMember GroupA –Type user) + (Get-QADGroupMember GroupB –Type user) | 
 Select-ExpandProperty DN
 Sort | Select-Unique

Group Intersection – users present in both groups at the same time:

Compare-Object (Get-QADGroupMember GroupA –Type user) `
 (Get-QADGroupMember GroupB –Type user) `
 -ExcludeDifferent -IncludeEqual | Select-ExpandProperty InputObject

You can obviously tweak them to add indirect users (with -indirect parameter) or enabled only (-enabled), etc. – see Get-QADGroupMember help for all options.

I am pretty sure that there are multiple ways to skin these cats – so if you have better alternatives – please post these in the comments.


My Recent Tweets

Legal

The posts on this blog are provided “as is” with no warranties and confer no rights. The opinions expressed on this site are mine and mine alone, and do not necessarily represent those of my employer - WSO2 or anyone else for that matter. All trademarks acknowledged.

© 2007-2014 Dmitry Sotnikov

September 2011
M T W T F S S
« Aug   Oct »
 1234
567891011
12131415161718
19202122232425
2627282930  
Advertisements

%d bloggers like this: