System Uptime Query in SCCM 2012 R2

what is the Query language statement to find the uptime of a system in SCCM 2012 R2? There are so many Object types that it is hard to see if anyone of them has this option.
Thanks

SELECT TOP (100) PERCENT dbo.v_R_System.Name0, dbo.v_GS_OPERATING_SYSTEM.LastBootUpTime0, DATEDIFF(Day, dbo.v_GS_OPERATING_SYSTEM.LastBootUpTime0, GETDATE()) AS [Days since last boot],
dbo.v_GS_OPERATING_SYSTEM.Caption0
FROM dbo.v_GS_OPERATING_SYSTEM INNER JOIN
dbo.v_R_System ON dbo.v_GS_OPERATING_SYSTEM.ResourceID = dbo.v_R_System.ResourceID
WHERE (DATEDIFF(Day, dbo.v_GS_OPERATING_SYSTEM.LastBootUpTime0, GETDATE()) > 7) AND (dbo.v_GS_OPERATING_SYSTEM.Caption0 LIKE '%server%')
ORDER BY [Days since last boot] DESC
This is something I built before.
It shows you server systems that have been online for more than 7 days.
You can modify it to your needs.

Similar Messages

  • Create a system properties Query in SCCM 2012 r2

    Hi,
    I am trying to create a query to find the "Computer description" field information for devices, but i am not sure of what criteria if any to select. 
    I was able to successfully create a query statement that finds the description information for a device, but that pulls only the AD object field information and not the local device information as described above.

    Is this the one?
    select SMS_R_System.ResourceId, SMS_R_System.ResourceType, SMS_R_System.Name, SMS_R_System.SMSUniqueIdentifier, SMS_R_System.ResourceDomainORWorkgroup, SMS_R_System.Client from SMS_R_System inner join SMS_G_System_OPERATING_SYSTEM on SMS_G_System_OPERATING_SYSTEM.ResourceID = SMS_R_System.ResourceId where SMS_G_System_OPERATING_SYSTEM.Description != 'Staff Device'

  • Create a query in SCCM 2012 R2 for NIC Driver Version

    Hello,
        Is there a way to create a query for the specific NIC driver versions with SCCM 2012 R2? For example I can do this and other descriptors for video i.e.,
    select SMS_R_System.Name, SMS_R_System.LastLogonUserName, SMS_R_System.HardwareID, SMS_G_System_COMPUTER_SYSTEM.Manufacturer, SMS_G_System_COMPUTER_SYSTEM.Model, SMS_G_System_VIDEO_CONTROLLER.DriverVersion, SMS_G_System_VIDEO_CONTROLLER.Description, SMS_G_System_VIDEO_CONTROLLER.VideoProcessor
    from  SMS_R_System inner join SMS_G_System_COMPUTER_SYSTEM on SMS_G_System_COMPUTER_SYSTEM.ResourceID = SMS_R_System.ResourceId inner join SMS_G_System_VIDEO_CONTROLLER on SMS_G_System_VIDEO_CONTROLLER.ResourceID = SMS_R_System.ResourceId where SMS_G_System_COMPUTER_SYSTEM.Model
    like "HP EliteBook Revolve 810 G2" and SMS_G_System_VIDEO_CONTROLLER.Description like "%intel%"
    Is there a script that will give the version for NICs?
    Thanks Bill

    This article provides one way to do it:
    http://blogs.technet.com/b/configmgr_geek_speak/archive/2013/11/10/inventorying-and-reporting-network-adapter-driver-details-and-how-to-report-only-the-wireless-type-in-configuration-manager-2012.aspx
    Jeff

  • Add site system role through automation, SCCM 2012 Sp1

    hi
    Trying to add a reporting point through powershell or the SDK with no luck.
    Does any out there have any idea how to do this? We are trying to automate the process of everything.
    When adding through powershell its a sucess with the role itself, but when accessing the reporting node the console crashes and the links are missing.
    Any ideas or tips?
    Regards
    Lasse
    shaggys

    This was finally fixed in
    CU3 for SCCM 2012 R2 and I can confirm that it does work with CU4 for SCCM 2012 R2.
    One note is that the cmdlet documentation is not 100% accurate.  For example, the example listed in get-help excludes required parameters.  Also, the parameter descriptions are not descriptive enough without knowing additional information
    about the role/point.  Here is what worked for me:
    Add-CMReportingServicePoint-SiteCode$SiteCode-SiteSystemServerName$SCCMpriFQDN-DatabaseServerName$SCCMpriFQDN-DatabaseName"CM_$SiteCode"-ReportServerInstance$SCCMsqlDatabaseInstanceName -FolderName"ConfigMgr_$SiteCode"-UserName$CMAaccountConfiguredAsSSRSexecutionAccount

  • Query about SCCM 2012 R2 Client Installation

    Hello I had one SCCM 2012 RTM environment with 1000+ clients,
    Now on the same machine I have uninstalled everything and installed fresh SCCM 2012 R2 software with same site Code etc..
    Kindly suggest me an easy way to upgrade all my SCCM clients to 2012 R2? and How do i verify the same?

    Hi,
     Currently, the clients cannot accept the policies from SCCM 2012 R2 MP, so Push installation, GP installation and manual installation should work. After upgrade, the GUID of clients will remain.
    Juke Chou
    TechNet Community Support

  • SQL Server 2012 deployment with System Center Configuration Manager (SCCM) 2012

    hi,
    we have tried to deploy the SQL Server 2012 to our development machines with SCCM 2012 without success.
    Commandline parameters or Configuration.ini in either case the installation failed without any useful errorlog.
    Exists any howto which covers this scenario?
    regards
    genne

    Hello,
    Please see the following article about some requirements for SQL Server instances intended for SCCM 2012:
    http://www.sqlcoffee.com/Tips0019.htm
    Could please check to see if a Summary.txt log file exists after those installation attempts? The following article may help you locate the file on disk:
    http://technet.microsoft.com/en-us/library/ms143702(v=sql.110)
    Please share this log file with us, if possible.
    Hope this helps.
    Regards,
    Alberto Morillo
    SQLCoffee.com

  • NETWORK PRINTER INVENTORY IN SYSTEM CENTRE CONFIGURATION MANAGER (SCCM 2012).

    SCCM HW inventory agent runs as the ‘SYSTEM’ and cannot see the end-users network drives and printers. The following two step process will help circumvent the above stated limitation.
    1) CREATE HKEY_LOCAL_MACHINE\SOFTWARE\SCCMINVENTORY\NETWORKPRINTERS PATH IN THE REGISTRY.
    Create a SCCM package.
    The package should run as administrator.
    The package should run whether or not a user is logged on.
    POWERSHELL PACKAGE 1 (Prerequisite):
    if (!(Test-Path HKLM:\SOFTWARE\SCCMINVENTORY)) {new-item HKLM:\SOFTWARE\SCCMINVENTORY -ErrorAction SilentlyContinue}
    $perm = get-acl HKLM:\SOFTWARE\SCCMINVENTORY -ErrorAction SilentlyContinue
    $rule = New-Object System.Security.AccessControl.RegistryAccessRule("Authenticated Users","FullControl", "ContainerInherit, ObjectInherit", "InheritOnly", "Allow") -ErrorAction SilentlyContinue
    $perm.SetAccessRule($rule)
    Set-Acl -Path HKLM:\SOFTWARE\SCCMINVENTORY $perm -ErrorAction SilentlyContinue
    if (!(Test-Path HKLM:\SOFTWARE\SCCMINVENTORY\NETWORKPRINTERS)) {new-item HKLM:\SOFTWARE\SCCMINVENTORY\NETWORKPRINTERS -ErrorAction SilentlyContinue}
    SAVE POWERSHELL FILE AS: PrinterInvRegSetup.ps1
    SETUP THE SCCM PACKAGE/PROGRAM WITH COMMAND LINE:
    %SYSTEMROOT%\System32\WindowsPowerShell\v1.0\PowerShell.exe -NonInteractive -WindowStyle Hidden -noprofile -ExecutionPolicy Bypass -file .\PrinterInvRegSetup.ps1
    2) CAPTURE CURRENT USER’S PRINTERS AND WRITE THOSE ENTRIES TO THE ABOVE CREATED REGISTRY KEYS.
    Create a SCCM package
    The package should be run only when a user is logged in.
    POWERSHELL PACKAGE 2 (Main):
    $printers = Get-WMIObject -class Win32_Printer -ErrorAction SilentlyContinue|select-Object -Property ServerName,ShareName,Location,DriverName,PrintProcessor,PortName,Local |Where-Object {$_.Local -ne $true}-ErrorAction SilentlyContinue
    ForEach($printer in $printers){
    $PServerName= $printer.ServerName -replace ('\\','')
    $PShareName = $printer.ShareName
    $PLocation = $printer.Location
    $PDriverName = $printer.DriverName
    $PPrintProcessor = $printer.PrintProcessor
    $PPortName = $printer.PortName
    if ((Test-Path HKLM:\SOFTWARE\SCCMINVENTORY\NETWORKPRINTERS)) {
    if ((Test-Path "HKLM:\SOFTWARE\SCCMINVENTORY\NETWORKPRINTERS\$PShareName on $PServerName")) {
    Remove-item "HKLM:\SOFTWARE\SCCMINVENTORY\NETWORKPRINTERS\$PShareName on $PServerName" -Force -ErrorAction SilentlyContinue
    New-item "HKLM:\SOFTWARE\SCCMINVENTORY\NETWORKPRINTERS\$PShareName on $PServerName" -ErrorAction SilentlyContinue
    New-ItemProperty "HKLM:\SOFTWARE\SCCMINVENTORY\NETWORKPRINTERS\$PShareName on $PServerName" -Name "PrintServer" -Value $PServerName -PropertyType "String" -ErrorAction SilentlyContinue
    New-ItemProperty "HKLM:\SOFTWARE\SCCMINVENTORY\NETWORKPRINTERS\$PShareName on $PServerName" -Name "PrinterQueue" -Value $PShareName -PropertyType "String" -ErrorAction SilentlyContinue
    New-ItemProperty "HKLM:\SOFTWARE\SCCMINVENTORY\NETWORKPRINTERS\$PShareName on $PServerName" -Name "PrinterLocation" -Value $PLocation -PropertyType "String" -ErrorAction SilentlyContinue
    New-ItemProperty "HKLM:\SOFTWARE\SCCMINVENTORY\NETWORKPRINTERS\$PShareName on $PServerName" -Name "PrinterDriver" -Value $PDriverName -PropertyType "String" -ErrorAction SilentlyContinue
    New-ItemProperty "HKLM:\SOFTWARE\SCCMINVENTORY\NETWORKPRINTERS\$PShareName on $PServerName" -Name "PrintProcessor" -Value $PPrintProcessor -PropertyType "String" -ErrorAction SilentlyContinue
    New-ItemProperty "HKLM:\SOFTWARE\SCCMINVENTORY\NETWORKPRINTERS\$PShareName on $PServerName" -Name "PrinterPortName" -Value $PPortName -PropertyType "String" -ErrorAction SilentlyContinue
    New-ItemProperty "HKLM:\SOFTWARE\SCCMINVENTORY\NETWORKPRINTERS\$PShareName on $PServerName" -Name "DateInventoried" -Value $(get-date) -PropertyType "String" -ErrorAction SilentlyContinue
    SAVE POWERSHELL FILE AS: NetworkPrinterInventory.ps1
    SETUP THE SCCM PACKAGE/PROGRAM WITH COMMAND LINE:
    %SYSTEMROOT%\System32\WindowsPowerShell\v1.0\PowerShell.exe -NonInteractive -WindowStyle Hidden -noprofile -ExecutionPolicy Bypass -file .\NetworkPrinterInventory.ps1
    3) CREATE A DEPLOYMENT AND SET IT TO ‘RUN ALWAYS’ AND MAKE IT A REQUIREMENT.
    Now deploy the second package and set the first package as a prerequisite (Check the box – Always run the prerequisite package)
    The deployment should be set to run every 4 hours and ‘Always rerun’. Mark the deployment as required. 
    4) ADD THE FOLLOWING IN BETWEEN THE EXTENSION SECTION WITHIN YOUR CONFIGURATION.MOF.
    //========================
    // Added extensions Start
    //========================
    #pragma namespace ("\\\\.\\root\\cimv2")
    #pragma deleteclass("NETWORKPRINTERS", NOFAIL)
    [dynamic, provider("RegProv"), ClassContext("Local|HKEY_LOCAL_MACHINE\\SOFTWARE\\SCCMINVENTORY\\NETWORKPRINTERS")]
    Class NETWORKPRINTERS
    [key] string KeyName;
    [PropertyContext("PrintServer")] String PrintServer;
    [PropertyContext("PrinterQueue")] String PrinterQueue;
    [PropertyContext("PrinterLocation")] String PrinterLocation;
    [PropertyContext("PrinterDriver")] String PrinterDriver;
    [PropertyContext("PrintProcessor")] String PrintProcessor;
    [PropertyContext("PrinterPortName")] String PrinterPortName;
    [PropertyContext("DateInventoried")] String DateInventoried;
    //========================
    // Added extensions end
    //========================
    5) SAVE THE BELOW DATA INTO A FILE CALLED ‘AWESOME.MOF’.
    #pragma namespace (“\\\\.\\root\\cimv2\\SMS”)
    #pragma deleteclass(“NETWORKPRINTERS”, NOFAIL)
    [SMS_Report(TRUE),SMS_Group_Name("NETWORKPRINTERS"),SMS_Class_ID("NETWORKPRINTERS")]
    Class NETWORKPRINTERS: SMS_Class_Template
    [SMS_Report(TRUE),key] string KeyName;
    [SMS_Report(TRUE)] String PrintServer;
    [SMS_Report(TRUE)] String PrinterQueue;
    [SMS_Report(TRUE)] String PrinterLocation;
    [SMS_Report(TRUE)] String PrinterDriver;
    [SMS_Report(TRUE)] String PrintProcessor;
    [SMS_Report(TRUE)] String PrinterPortName;
    [SMS_Report(TRUE)] String DateInventoried;
    6) IMPORT ‘AWESOME.MOF’ INTO SCCM DEFAULT CLIENT SETTINGS.
    Either import the above MOF file into the Client Setting/Default Client Settings/Hardware Inventory/Classes/Import. Select the option to import every thing.
    Alternatively, if you have compiled the MOF manually on the PC, Add a new reporting class by clicking the ‘Add’ button and connecting to the PC and selecting the WMI class ‘NETWORKPRINTERS‘
    and that is it. The SCCM resource explorer should soon see the Network Printers.
    Now, this is a convoluted process but this is the only way I can inventory Network printers. Any ideas or suggestions?

    All the other ways are similar because this is a per-user setting.
    http://blogs.technet.com/b/breben/archive/2013/08/26/inventory-mapped-drives-in-configmgr-2012.aspx
    Juke Chou
    TechNet Community Support

  • WMI Query to SCCM 2012 results zero results in c#

    In 2007 this works without issues, however in 2012 when attempting the 2nd query it returns zero results.  However if I do this manually I can produce results...Here is my code:
    using (WqlConnectionManager connection = Connect(getServer))
       string query = "select * from SMS_ObjectContainerItem WHERE ContainerNodeID='" + ProfileID + "'";              
       foreach (IResultObject getobject in connection.QueryProcessor.ExecuteQuery(query))
         getPackageID = getobject["InstanceKey"].StringValue;
         query = "select * from SMS_Collection WHERE CollectionID='" + getPackageID + "'";
    **This is where it will return zero results**
         foreach (IResultObject searchID in connection.QueryProcessor.ExecuteQuery(query))
            CMProfiles profile = new CMProfiles();
            profile.Name = searchID["Name"].StringValue;
            profile.ID = getPackageID;
            results.Add(profile);
    I'm pulling my hairs trying to understand by the 2nd query is not returning any results. When this works fine in SCCM 2007

    What you are using here are the SDK libraries, which are admittedly very thin wrappers around WMI, but not quite.  Have you tried implementing this directly using WMI?  I have written software that manipulates 2007 / 2012 and eventually found that
    the SDK libraries just sort of got in my way, so now I do all of my interactions with SCCM directly with WMI and forgoe the SDK libraries.
    Before I changed over, I did find that there are some oddities in using the SDK.  What I eventually found that worked for me was to bind to the 2007 SDK libraries, deliver them with my application and use the 2007 libraries regardless of if I was connecting
    to 2007 or 2012.  What I found was that I would run into issues using the 2012 libraries to talk to 2007, but the 2007 libraries would work fine with both.
    I have tested your queries, directly using WMI and PowerShell on a 2012 server and they work fine.  I am presuming that the folder that you are attempting to access is a Device Collection folder.
    Once again, I would suggest using WMI directly, especially if making a product that will work with 2007 and 2012; you will be a much happier person.
    It would be greatly appreciated if you would mark any helpful entries as helpful and if the entry answers your question, please mark it with the Answer link.

  • System Discovery Issues in SCCM 2012

    SCCM is not discovering all resources from AD OU. What could be the reason for this. This is not happening for all OU's but randomly for some of them.
    Is there a method to force the system discovery to run instantly ?

    Thanks Jason,
    I think my query was mixed up.
    2) Will the status be NO client ?, If yes, does that mean the complete
    cycle will start again? Meaning as the client is already inactive, it will not send any more hearbeat and configmgr will again wait for the specified days before deleting it again ?
    I know the difference between AD and Heartbeat discovery. I am trying to get a clear difference between
    delete Inactive discovery data and delete
    aged discovery data.
    I checked a blog, I think this is from you http://www.myitforum.com/forums/Delete-aged-discovery-data-and-delete-inactive-client-discovery-data-m204924.aspx
    , where it says "For the Delete Inactive Client Discovery
    Data task, if you haven't cleaned up AD, the object will get recreated (without the client installed flag). If you auto client push enabled, ConfigMgr will try to push to the system again"
    What I get from here is, client status will be NO when it is rediscovered from AD.
    Now if the machine was already deleted with Delete Inactive discovery data maintenance task, and its rediscovered, the client will again become Inactive as the machine is
    not in use. Will the Inactive discovery maintenance task wait again for defined days before it deletes this machine from the database.

  • How to query in SCCM 2012 to know how many active and inactive clients in a specific time and date

    Dear Everyone,
    Good morning. I need to perform a query to know how many clients PCs are active or inactive during the a specific time and date (let say, today 9pm). In my query, I want to know:
    1. How many client PCs is active at that time and date?
    2. How many client PCs is not inactive at that time and date?
    Any assistance is greatly appreciated. Thanks.

    Thank you Gerry for pointing out that it doesn't show real time date. I do agree with that. However, I am look at the (at least in this) report which supposed to [description] shows a list of computers not reporting any power activity for a specified date
    and time. Since I can only key in date in my selection (time option not given), I am expecting the report to show me whether there any client PCs that doesn't any power activity for the specified date. A list was generated, and a number of them shows HardwareInventoryScan,
    LastHeartBeatScan and LastPolicyRequest on the same date itself. I would like to know why these appears, so that I can learn from it.
    Due to the selection option given, I can't expect my original goal, but at least (hopefully) I can get to know (past event) how many and which client PCs is not powered on a particular date based on the date and collection selected.
    At least by getting explainations, I hope to learn something from this (how to read this report). Thanks in advance.

  • Create Report based on Query in SCCM 2012

    I have a lot of useful queries, however I would like to create a few reports based on these queries. What is the simple way to do this? I started to create a New Report, but kind of lost after that. Is there a way I can just copy my statement from the
    query to a blank report?

    Execute the WQL query from the queries node in the console and watch smsprov.log on the site server. It should contain the "translated" SQL statement.
    Torsten Meringer | http://www.mssccmfaq.de

  • SCCM 2012 Query to find units with IPv6 Enabled?

    We've found a need to locate computers that may have IPv6 enabled for audit purposes, and then we'll disable them at a later date.
    Has anyone been able to create a successful query in SCCM 2012 to get that information? 
    I found this but it spit back the IPv4 info for all the units in our device collection, plus it's for SCCM 2007. http://www.myitforum.com/forums/Query-for-systems-with-IPv6-enabled-m227020.aspx
    Appreciate any input, thanks!
    This topic first appeared in the Spiceworks Community

    If you're using % in the value field the operator must be "Like" . In your case, the query should look like
    select SMS_R_USER.ResourceID,SMS_R_USER.ResourceType,SMS_R_USER.Name,SMS_R_USER.UniqueUserName,SMS_R_USER.WindowsNTDomain from SMS_R_User where SMS_R_User.UserPrincipalName Like
    "TQA%" order by SMS_R_User.UserPrincipalName
    Kindly mark as answer/Vote as helpful if a reply from anybody helped you in this forum. Delphin

  • SCCM 2012 report for all versions on MS lync installed

    Hello,
    I have installed Microsoft Lync 2010 and Lync 2013 on computers in my company and I have different versions
    like 32 and 64 bits, 365 etc I want to make query in SCCM 2012 to tell me the total number of Microsoft Lync clients Installed on win 8 machines in my company, is there a best way to do this I need your advice..
    I have tried various built in reports and not been successful so far.
    Thanks in Advance

    There's a thread already explaining this :
    http://social.technet.microsoft.com/Forums/en-US/f16f1ee8-206c-42a1-af0e-0363c51b840c/how-to-know-total-of-microsoft-lync-installed-on-computers-in-sccm-2012?forum=configmanagergeneral
    Benoit Lecours | Blog: System Center Dudes

  • New SCCM 2012 client machines still getting SCCM 2012 SP1 client not the new SCCM 2012 SP1 CU3 client

    Hi,
    I've successfully (as far as I can tell) deployed SCCM 2012 SP1 CU3 and all my existing clients are showing a client version of 5.00.7804.1400.  But when I setup a new client system recently I noticed that the client version was showing 5.00.7804.1000,
    and not 5.00.7804.1400. 
    For new client systems, do I need to redeploy the packages that were created for SCCM 2012 SP1 CU3 so that the new systems get the new SCCM 2012 SP1 CU3 client? 
    Thanks,
    Nick

    Hi,
    Here's some good information to look over:
    http://sccmfaq.wordpress.com/2013/09/24/sccm-2012-include-cu-in-osd/
    I haven't followed these instructions myself, since I haven't really had any good reason to include CUs during the initial installation process. I use this method instead and I've never run into any problems:
    http://www.ronnipedersen.com/2013/06/installing-sccm-2012-sp1-cu2-quick-start-guide/
    Don't retire TechNet! -
    (Don't give up yet - 12,575+ strong and growing)

  • Editing Configuration.MOF For Network Printers/Mapped Drives SCCM 2012?

    Question is in Configuration Manager 2007 I would edit the SMS Def MOF file and then run Datashift.vbs on all the clients to add a WMI class for mapped drives for inventory.  So most of my clients that I upgraded to 2012 already have that class added
    to WMI. I just need to figure out what I need to do on the new server and Configuration.MOF (since SMS Def is missing in 2012) to tell it to collect the newly added classes during hardware inventory. I see that you can click on Set Classes in the client settings
    but I don't see where you can check mapped drives or network printers there.

    There is no out-of-box solution to handle this task.
    But try this. This has worked for us really well. We've got 22000 machines inventoried.
    http://social.technet.microsoft.com/Forums/en-US/c08c393d-1ea4-4f6b-8f07-affc0f743193/network-printer-inventory-in-system-centre-configuration-manger-sccm-2012?forum=configmanagergeneral#c08c393d-1ea4-4f6b-8f07-affc0f743193

Maybe you are looking for

  • 2012 Mac Mini Windows Support Drivers

    Hey! So I installed Windows 7 on my Late 2012 Mac Mini and let bootcamp save the Windows support files onto a USB Drive. My plan was to install windows over OSX as i have an SSD in the post where i aim to install OSX onto (2 drives in 1 mini). Howeth

  • Modified Date changes to now by selecting (not opening) vmwarevm file

    Yosemite OSX 10.10.2 VMware Fusion is currently not running, and it's disabled (an older version not compatible with Yosemite has not yet been upgraded) so I don't think Fusion is doing this.... I have VM files (.vmwarevm) that were not opened for mo

  • Evenlog viewing causes CPU usage 100% on Windows server 2008 SP2

    We have Windows server 2008 SP2 with strange behaviour. When I scroll down events in eventlog viewer CPU usage hits 100% and eventlog viewer freeze. CPU usage is split between 2 processes SVCHOST.EXE (lmhosts, eventlog and Dhcp services) and MMC.EXE.

  • Mail rebuild

    I'm having an issue with mail that has been getting progressively worse. The emails that I'm receiving through my iCloud account appear correctly when I open them from the message view column. However, mail randomnly changes the sender name and detai

  • Table for Confirmation numbers

    Hi Can any one provide the Table exclusive which show the Operation number and Confirmation numbers for a given Order. Provide Table other than AFRU and AFVC . AFVC does not have the input field AUFNR (Production Order) AFRU only prodes the completed