Script to determine the type of OS related

Hello

I am trying to determine the version or the name of the operating system used by the Client of the view for use in a Powershell script. I know that in the variables view / volatile environment that ViewClient_Type stores Windows, but I would like to get more detailed, then just information Windows. I was wondering if anyone had come across similar scenarios and might be able to provide assistance or suggestions on ways to circumvent this. The environment is running VMWare View 5.0.

I tried to use a remote WMI query - that works fine for a user admin, but the majority of users is an admin rather than on the local client, and I'm a little reluctant to the idea of having to change the WMI security on each client to make it work.

Any help would be great.

Thank you

Alan

Try this one..# ==============================================================================================
#
#
# NAME: ADCompOSinfo
#
# AUTHOR: Mohamed Garrana ,
# DATE  : 3/25/2010
#
# COMMENT:
# This script connects to Active Directory OU or just the root of the domain and recursivly gets all the computer objects
# for each AD computer object it gets the Opertating system Type , Version and Service pack using information of the AD object
# ============================================================================================== 

function get-alladcomputers { 

    Trap { Write-Host -ForegroundColor Red "   <<< Error >>>  could not connect to Active directory, please make sure that ADpath var is correctly SET !"
        Break 

    } 

    $ADpath = "LDAP://DC=mantrac,DC=win2k,DC=dom"
    $searcher = New-Object DirectoryServices.DirectorySearcher
    $RootSearch = New-Object directoryservices.directoryentry $ADpath
    $searcher.searchroot = $RootSearch
    $searcher.filter = "(objectClass=computer)"
    $allcomps = $searcher.findall()
    foreach ($comp in $allcomps) { get-adcomputerinfo }
    $objs = $allcomps | Measure-Object
    $objcount = $objs.Count
    Write-Host -BackgroundColor green -ForegroundColor blue " Script succesfully Completed on $objcount Active Directory computer objects"
    } 

function get-adcomputerinfo {
    BEGIN { }
    PROCESS  {
    Write-Host $comp.Properties.name
    try {
    $name = $comp.Properties.name[0]
    $os= $comp.Properties.operatingsystem[0]
    $osver= $comp.Properties.operatingsystemversion[0]
    $ossp=$comp.Properties.operatingsystemservicepack[0]
    }
    Catch {
    Write-Host -ForegroundColor Red "   <<< WHoops ... >>>  $name : Error reading a required property from the AD computer object, this might be a cluster resource name or the property has a null value . execution will continue anyway ;)"
        continue
        }
    finally { 

    $computer = New-Object psobject
    $Computer | Add-Member NoteProperty Name ($name)
    $computer | Add-Member NoteProperty OperatingSystem ($os)
    $Computer | Add-Member NoteProperty OSVersion ($osver)
    $computer | Add-Member Noteproperty OSServicePack ($ossp)
    Write-Output $computer
    }
    }
    END{}
}
#set your variables :-  

#setting the ADpath variable
$ADpath = "LDAP://DC=microsoft,DC=com" # this will grap all the AD computer objects in the microsoft.com domain
#$ADpath = "LDAP://OU=Marketing,DC=Microsoft,DC=dom" #this will grap all the AD computer objects in the marketing OU in the microsoft domain 

#you can use the script like this to export the output into a csv file with all the computers and their OS information
$outfile = "c:\test\ADcomps2.csv" #sets the location of the out csv file if you'r going to use Export-csv
get-alladcomputers | Export-Csv $outfile 

#you can use the script like this to see a nice grid view of all the computers and their OS information
get-alladcomputers | Out-GridView

Cheers, Udin

Tags: VMware

Similar Questions

  • Unable to determine the type of AC power adapter. Dell Inspiron 1545.

    Hi all

    Just recently I started receiving the error message bad "cannot determine the type of AC power adapter. Your system will run more slowly and the battery won't charge. "Please connect a Dell 65W adapter or higher for a better functioning of the system.

    I've had my dell inspiron 1545 since 2009. I had to replace my battery once because I kept getting an error message. The error message above, I have been doing hard for about a week now. I had read that push the cord into the laptop could work. I know it sounds stupid, but I actually tried and for some time the adapter started to charge my battery again. But whenever I turn off my laptop I have to re connect the adapter because I get this error again. About 2 days ago, I tried my usual method of shoving the cord, but now the method does not work and my battery fell to 18%. I must say that I always keep my plugged power cord because my battery never lasted more than an hour before.  It seems that my card still works when I plug it into the wall of blue light still appears. When I plug it into the laptop computer, the icon appears that it is plugged in and the display becomes brighter. I am also able to remove my battery and work on my laptop as long as the AC adapter is plugged. I'm really afraid that this problem is related to the motherboard.

    Any ideas?

    Thanks in advance.

    First thing to try is a new Dell AC adapter - if this doesn't fix the problem, replace the power supply (see link below).  And in the unlikely event, he is not taking or adapter, the motherboard needs to be replaced.

    www.Parts-People.com/index.php

  • Determine the Type of connection WiFi

    Hello

    Is it possible in the OS X in order to determine the type of connection (a/b/g/n/ac) current WiFi?

    Thank you

    Option + click on the WiFi symbol in the menu bar.

  • How to determine the type of device programmatically

    Hello

    I think I need determine the type of device (IE. Bold, Curve etc.) in order to use the appropriate images.  I can't find a api that indicates to which device the application runs on... could someone point me in the right direction?

    In addition, is the type of device, the best way to do it... or use the width of the display or resolution and choosing him the appropriate icon a better idea?

    Thank you

    check the DeviceInfo class.

    I use the screen resolution to determine the size of the icons. I use two sets of icons, one for the kid, one for big screens.

  • Determine the Type of connection

    Hello

    Because each type of connection (MDS/BES, TCP, BIS, WiFi) requires a suffix different http to establish a connection, is it possible to programmaticaly determine what type of connection is currently active on the BlackBerry to a user?

    I checked this site http://www.blackberry.com/knowledgecenterpublic/livelink.exe/fetch/2000/348583/800451/800563/What_Is...

    and although the example seems pretty complete, I wonder if there is something in the API that can be used to quickly determine the type of connection of the user.

    Thank you!

    As far as I know, up to the 5.0 OS, the methods used in the Network Diagnostics tool are the best API available to do what you want.

    I suggest that you ignore the Thread amardeepjaiman has referenced, despite the title, there is no discussion on the change of the type of connection depends on the force.

  • Reference Dell vostro 7110 that cannot determine the type of adapter power ac

    When I put my charger it says could not determine the type of ac that the battery was at 0% for a while but the other day I noticed that it was fully charged so that the charger must have worked for a bit but its wrong now again all the ideas it might be?

    Hello

    I suggest you follow these methods and check.

    Method 1:  Unplug the AC adapter and the battery from the computer and then press on and press and hold the power button for 10-15 seconds and then release the power button, plug in the AC adapter and the battery and then try to start the computer and check if you get the error message even if you get always the second error message try stage.

    Method 2:  Try to update the computer BIOS, please visit this link.

    http://www.Dell.com/support/drivers/us/en/19/DriversHome/NeedProductSelection

    Download the latest version of the BIOS, BIOS, download and run (installation) BIOS, restart the computer and check if you get the same error message or not

    I also suggest you to check with Dell. Use this link. http://en.community.Dell.com/support-forums/laptop/default.aspx

    I hope this helps!

  • Essbase calc script to determine the number of occurrence

    Hello

    is it possible within a calc script to determine the number of occurrence of a value in the account dimension?

    I have an account called ranks which can contain any value between 1 and 10.  I would like to know how many times each value is repeated for a specific cost center.  It's in a database of planning BSO.

    Thanks in advance for your contributions...

    CL

    This isn't the typical calculation you would do in an OLAP architecture, but yes it is certainly possible.

    you will need to create 10 accounts such as occurrence_of_1, occurrence_of_2 etc.

    Then you increment them according to the value of the 5th year.

    Don't forget to put in your calculation!

  • What is the custom property that determine the Type of disc Provisoning?

    Hello

    I wonder what would be the custom property that determines the type of disk configuration during the construction of the virtual machine. I had noticed, VMS that are cloned with VM model with thin provisoning get the drive put in service end however if one adds the additional drive for the virtual machine of the vCAC, they get set up as 'Thick lazy disposition to zero' which I don't want but I wanted this type of control.

    I'm sure there should be value for the same property portfolio, but I am not able to find, someone used or?

    BR,

    MG

    VirtualMachine.Admin.ThinProvision = true / false

  • How to enable the end user determine the type of sort?

    Helllo all,.

    I use APEX 4.2.2. Oracle 11.2.0.3.

    In a classic Rerpot (line custom model), how to allow the end user to determine the type of sorting?

    I use decoding to select the column that the sort is done, but how to determine: Asc / Desc?

    order by decode(:P2_SORT, 'PRICE', v.PRICE, 'PROP_SIZE', v.PROP_SIZE , 'BEDS' , v.BEDS , 'AREA' , v.AREA) 
    

    Kind regards

    One way may be to use a second element which maintain the sort order. Lets call it P2_ASCDESC.

    Your order by condition might look like this:

    order by decode(:P2_ASCDESC,'ASC', decode(:P2_SORT, 'PRICE', v.PRICE, 'PROP_SIZE', v.PROP_SIZE , 'BEDS' , v.BEDS , 'AREA' , v.AREA), null) asc
            ,decode(:P2_ASCDESC,'DESC', decode(:P2_SORT, 'PRICE', v.PRICE, 'PROP_SIZE', v.PROP_SIZE , 'BEDS' , v.BEDS , 'AREA' , v.AREA), null) desc
    

    I don't like this solution, since you réimplémentez one of the nicer features that apex was already out of the box. Better would be to stick to a classic report template and allow the standard user-defined sort order. Why do you think that you need your own non-standard solution?

  • determine the type of data

    Hi all

    I've got procedure of inserting data in table1 value1 column.
    My need is to determine the type of data entered by the user.
    If the data type is not number user should error.
    How can I make it?

    The easier and more reliable way would be to declare the formal parameter as a number, such as:

    SQL> create procedure p (p_num in number) as
      2  begin
      3     null;
      4  end;
      5  /
    
    Procedure created.
    
    SQL> exec p('a');
    BEGIN p('a'); END;
    
    *
    ERROR at line 1:
    ORA-06502: PL/SQL: numeric or value error: character to number conversion error
    ORA-06512: at line 1
    

    If you cannot do this, or want to be more "user friendly", so the only alternative is to test and trigger an error like:

    SQL> create procedure p (p_str in varchar2) is
      2     l_num number;
      3  begin
      4     l_num := to_number(p_str);
      5  exception
      6     when value_error then
      7        raise_application_error(-20001, 'I know I said it was a string, but I really want a number');
      8  end;
      9  /
    
    Procedure created.
    
    SQL> exec p('a');
    BEGIN p('a'); END;
    *
    ERROR at line 1:
    ORA-20001: I know I said it was a string, but I really want a number
    ORA-06512: at "OPS$ORACLE.P", line 7
    ORA-06512: at line 1
    

    John

  • [CS2] [VB] How can I determine the type of object to a PageItem?

    I use InDesign CS2 and VBScript

    Loop to the bottom of the PageItems in a Page, I need determine the Type of object (TextFrame, group, GraphicLine... each process) and PageItem accordingly.

    Is there a method/function VBS wiil returns the Type of an object as a string or a value. Or what I need to check the existence/non-existence of a particular property associated with a particular object for this type?

    Alternatively, is there a JavaScript function that will do what I can call VBScript?

    For the record: TypeName is what you need.

    For example, when the cursor is planted in the text return TypeName (Ind.Selection (1)) 'PointInsertion.' When a text block is selected, it returns "TextFrame.

  • How can I determine the type of image to be used before loading an image?

    I'm developing an application using VB 2005 which measures two 8-bit or 16-bit image files. When I saw the picture, I find that I have to set the type of image the image buffer before playback of the image in it. For example, if I read a 16-bit image in a buffer of 8 bits, the image is truncated. I guess I could read the image in a 16-bit buffer and retype it if the pixel values are less than 255.

    Is there a better way to do it? Can I determine the number of bits of an image before loading in a buffer?

    Thank you!

    Hi Steverino,

    Olivia is incorrect... VDM has a function called GetFileInfo which does just what you want. It only reads the header of the image but does not load the entire image in memory. It will give you various properties such as the bit depth.

    I think that on the new .NET support, there can exist here: NationalInstruments.Vision.Analysis.Algorithms.GetFileInformation.

    Thanks to the ICB and our legacy of .NET support, it's probably a similar name.

    Eric

  • How financial analytics to determine the types of dimensions

    How can we determine what types of dimensions are built by Oracle as part of OLIVIER? I am wanting to understand the types of dimensions (Type I, Type II and one who is slowly changing dimension and what columns are used for dates to keep history of these dimension tables) for all of the dimensions of the box provided.

    Pointers on this is much appreciated.

    Thanks in advance
    Kris

    Published by: user566193 on May 14, 2011 22:59

    Hi, for BIApps v > = 7.9.6.x Look Design-->--> Tab(bottom pane) the task settings. You will see *' $$ TYPE2_FLG ' * parameter (look at the specific SIL tasks in the list)

    For older versions of BI applications find you in DAC--> Design--> Source system settings tab

    I hope this helps!

  • Open a new File() by Script and set the Type of PDF file fails...

    Hi all

    I created a script to download PDFs from a server and store them in an Indesign Document. Everything works fine except Indesign doesn't not recocnize file Type when you try to place the pdf file and get an error that the downloaded PDF file cannot be due to the filter of the unknown.

    This is because the file type is apparently set to TEXT (creator is CARO) event if I write the file with

    myFile.open ('w', 'PDF', "CARO");

    No idea how

    -get Indesign all the file type of a file newly generated in PDF format

    or

    -Change the Type of file later

    or

    -tell Indesign what filter to use when you place this file?

    Thanks for your help

    BTW: Indesign CS5 (7.0.4), OS X 10.6.8

    UH... but you might be better off placing both '\0\0\0\0' and leave the treatment kick file extension.

  • shell script to determine the width of the file, size, resolution cs5 js

    I use a Script of Michael L Hale (core.quickMetadata "that uses" xmp.getProperty "and the bridge") to determine the size and the resolution of files without having to open or place.

    Unfortunately, it fails with some files (non-Photoshop generated bitmaps, seems).

    (PDF, I treat differently altogether to avoid the problem determination pages pdf counties and potential problems with PDFs containing different size pages.)

    "None of you do not know if and how you can reach resolution with" app.system "in CS5, the height, the width of the files?

    I may have come across before, but is unable to locate such a thread currently.

    Thanks for any input.

    The following 2 options that you can use if you want to clear all information in text file then analyze js. You could see if one of these contain the data that you are after?

    #target bridge
    
    var foo = File('~/Desktop/SomeFile.tif');
    
    getAllXMLSIPS(foo);
    
    //getMetaDataMDLS(foo)
    
    function getAllXMLSIPS(f) {
         if (f instanceof File && f.exists) {
              var shellString = "sips --getProperty allxml ";
              shellString += f.fsName;
              shellString += ' > ~/Documents/StdOut.txt';
              app.system(shellString);
         }
    }
    
    function getMetaDataMDLS(f) {
         if (f instanceof File && f.exists) {
              var shellString = "/usr/bin/mdls ";
              shellString += f.fsName;
              shellString += ' > ~/Documents/StdOut.txt';
              app.system(shellString);
         }
    }
    

Maybe you are looking for

  • Hinge problem

    The screws are falling down the plastic case of my HP Pavilion dv7 Notebook around the hinge area.  I've seen others ask questions about this same issue on other models.  What's the universal of hinges or specific model.  Where I could get replacemen

  • 10 google game store slatebook stops

    Hi, I just bought a book10x2 slate pc, running android 4.3 model number 10-h000sa. I really like it, but at startup I get the message "Unfortunately google game stopped" if I click ok it goes and the Tablet works fine. Someone has any suggestions how

  • How to set up a PPPoE connection?

    I want to know if anyone knows how to set up a PPPoE with Windows Vista Home Premium.  I have Comcast as a provider of services and I am already able to go online with the wireless router, but I put it in place as a dynamic connection instead of a PP

  • All my icons changed to itunes logos and they all windows open itunes

    How to restore all my desktop icons. They currently had at all the logos of itunes and itunes open only all even though shortcuts are labelled with what they were before.

  • I have win 7 on my pc I have no games how can I git win 7 game

    I have win 7 on my pc I have no games how can I git win 7 game