locked
PowerShell quesiton RRS feed

  • Question

  • Hi

    I'm looking at running a PowerShell script to get 2 bits of info and am struggling slightly. This is using exchange online. 

    What I want is to get a list of all users with a forwarding address I know how to do this in PowerShell and then of those users I need to list who is a member of a certain distribution list, again I know how to do the distribution list bit and the forwarding address separately but can't work out how to join the 2 together, short of exporting to a CSV first then running the dist list member CMDLET against the exported CSV. 

    Thanks 

    Friday, October 7, 2016 9:15 AM

Answers

  • Create Custom Object
    Ex

    $Bios = Get-WmiObject Win32_bios #
    $OS = Get-WmiObject Win32_operatingSystem | select *
    
    $Prop = [Ordered]@{OS = $OS.Caption ; BuildNumber = $OS.BuildNumber ; Bios = $Bios.Name ; BiosVersion = $Bios.Version}
    New-Object PSObject -Property $prop 

    or

    #Requires PowerShell v3
    [PSCustomObject]@{OS = $OS.Caption ; BuildNumber = $OS.BuildNumber ; Bios = $Bios.Name ; BiosVersion = $Bios.Version}
    

    Friday, October 7, 2016 9:58 AM