Help exporting list of OS versions for multiple machines using Active Roles Management Shell

Hi all,

Apologies if this is in the wrong place,

I'm very new to Active Roles and have been tasked with obtaining the OS of multiple machines throughout the business.I have the list in a .CSV format and I would like to run a script that will ask Active Roles to check the machines on the list determine what OS they are running and then export it to a new list. Is there any way that can be done. I know it is possible in AD but I have struggled for a way to do it through Active Roles.

If anyone knows of a way it would be very much appreciated.

Kind Regards,

K

  • I'm curious why you feel you want Active Roles in the mix here?

    Do you want a user to be able to launch this query from within the Active Roles UI?

    Do you want this to occur on recurring, scheduled basis?

    Do you want Active Roles to perform the initial enumeration of the machines for you and display them in a Managed Unit?

    Within Active Roles, you could create an AR Scheduled Task associated with a Scheduled Task script (which is just Powershell code that you import as a "Script Module").  The reading and writing of your CSV would be handled by the script.  The creation of the Managed Unit above would save you writing code for object enumeration but is not required unless you want to give users an easy way to see the machines of a particular OS in the UI for some reason.

    'Hope this is helpful food for thought.

  • Hi 

    There a many ways this data can be gathered, but depends on if it should be initiated from the CSV file or the data source (AD).

    If you initiate from AD (whether via AD or the ARS modules)

    AD:

    $Computers = Get-ADComputer -Properties operatingSystem -filter *
    
    "Computer,OperatingSystem" | Out-File -FilePath "$($env:USERPROFILE)\Desktop\ADComputerObjects.csv"
    ForEach($Computer in $Computers)
    {
        "$($Computer.name),$($Computer.OperatingSystem)" | Out-File -FilePath "$($env:USERPROFILE)\Desktop\ADComputerObjects.csv" -Append
    }

    ARS (to AD):

    $Computers = Get-QADComputer
    
    "Computer,OperatingSystem" | Out-File -FilePath "$($env:USERPROFILE)\Desktop\ARSComputerObjects.csv"
    ForEach($Computer in $Computers)
    {
        "$($Computer.name),$($Computer.OperatingSystem)" | Out-File -FilePath "$($env:USERPROFILE)\Desktop\ARSComputerObjects.csv" -Append
    }

    ARS (to ARS):

    $Computers = Get-QADComputer -proxy
    
    "Computer,OperatingSystem" | Out-File -FilePath "$($env:USERPROFILE)\Desktop\ARSComputerObjects.csv"
    ForEach($Computer in $Computers)
    {
        "$($Computer.name),$($Computer.OperatingSystem)" | Out-File -FilePath "$($env:USERPROFILE)\Desktop\ARSComputerObjects.csv" -Append
    }

    or you create a Managed Unit which includes all computers, the add the columns you want. Then export the content of the Managed unit (using inbuilt functionality in the WI) out to file.

    To do the inverse and query by your CSV, you'd need to 

    1. Read in your CSV file
    2. Search for the Computer in AD/ARS, and retrieve the OS
    3. Write the details out to file.