How can I get data, as opposed to compliant/not-compliant, from compliance?

I'm new to configuration manager, but I have been through the 2012 MS training class.
My issue is, I'm trying to determine how I can use SCCM in general and Compliance in particular to collect data on the clients.  Here are some examples of the data that I need to collect:
The members of the local administrators group.
The updates that are needed and count of updates that are needed.
The configuration settings (time zone, pagefile configuration, IE ESC status, Firewall settings, SFP setting, and so on.
The frequency of update installation over the past year (or whenever the event log rolls over)
I need to collect this information and report it out in a custom report.  I've tried to do this with compliance, by creating a baseline and deploying it to clients, then adding a configuration item for each piece I want to capture.  The problem
I'm experiencing is that it looks like compliance is giving me a boolean result - compliant or not compliant, when I go to run a report on the data.  I want to get the actual data, in addition to whether or not it is compliant.
I want to use compliance, so I can take advantage of the auto-remediation.  I have set up the configuration items with both check powershell scripts and remediate powershell scripts.
On a related but possibly separate note, I also used a configuration item to attempt to collect data into an MSSQL server.  I created a powershell script that gets the data, and connects to MSSQL and inserts the data; the problem is, that it appears
to not be working.  If I run the script from an interactive powershell command promt or from an iteractive command line, it runs fine.  It even works if I run it from a scheduled task.  But it doesn't appear to work running it from the configuration
item in SCCM 2012 R2, even though Powershell is listed as a valid script type.  Two notes: The execution policy on the clients is set to unrestricted, and the firewall is OFF on the clients.
So my questions are:
Am I going about this the right way?  If not, how SHOULD I go about this?
Am I missing anything in trying to run the powershell scripts in the configuration item?
Here is the script I am trying to run.  I realize that it has the check code mixed with the remediation code, I plan to separate the two once I have the powershell running and updating the database.  Also, I replaced the sensitive information in
the SQL connection string.
$Comp=$env:COMPUTERNAME
Write-Host $Comp
$LocalMachine=Get-ExecutionPolicy -Scope LocalMachine
Write-Host "Local Machine:" $LocalMachine
$UserPolicy=Get-ExecutionPolicy -Scope UserPolicy
Write-Host "User Policy:" $UserPolicy
$Process=Get-ExecutionPolicy -Scope Process
Write-Host "Process:" $Process
$CurrentUser=Get-ExecutionPolicy -Scope CurrentUser
Write-Host "CurrentUser:" $CurrentUser
$MachinePolicy=Get-ExecutionPolicy -Scope MachinePolicy
Write-Host "MachinePolicy:" $MachinePolicy
$Conn = New-Object System.Data.SqlClient.SqlConnection
$Conn.ConnectionString="Server=SQLInstance;Database=DBName;User Id=user;Password=password"
$Conn.Open()
$Comm = New-Object System.Data.SqlClient.SqlCommand
$Comm.Connection=$Conn
$comm.CommandText="DELETE PSExecPolicies WHERE ServerName='" + $Comp + "'"
$Comm.executenonquery()
$CmdStr = "INSERT INTO PSExecPolicies (ServerName, LocalMachine, UserPolicy, Process, CurrentUser, MachinePolicy) VALUES ('" + $Comp + "','" + $LocalMachine + "','" + $UserPolicy  + "','"
+ $Process + "','" + $CurrentUser  + "','" + $MachinePolicy + "')"
$Comm.CommandText = $CmdStr
$Comm.ExecuteNonQuery()
$comm.dispose()
$Conn.Close()
$Conn.Dispose()
if ($MachinePolicy -like "Restricted" -or $MachinePolicy -like "Undefined")
Write-Host "Machine Policy policy was " $MachinePolicy ", changing it to Remote Signed."
Set-ExecutionPolicy RemoteSigned -Scope MachinePolicy -Force
Else
Write-Host "Machine Policy policy was already" $MachinePolicy ", making no changes."
if ($UserPolicy -like "Restricted" -or $UserPolicy -like "Undefined")
Write-Host "User Policy policy was " $UserPolicy ", changing it to Remote Signed."
Set-ExecutionPolicy RemoteSigned -Scope UserPolicy -Force
Else
Write-Host "User Policy policy was already" $UserPolicy ", making no changes."
if ($Process -like "Restricted" -or $Process -like "Undefined")
Write-Host "Process policy was " $Process ", changing it to Remote Signed."
Set-ExecutionPolicy RemoteSigned -Scope Process -Force
Else
Write-Host "Process policy was already" $Process ", making no changes."
if ($CurrentUser -like "Restricted" -or $CurrentUser -like "Undefined")
Write-Host "Current User policy was " $CurrentUser ", changing it to Remote Signed."
Set-ExecutionPolicy RemoteSigned -Scope CurrentUser -Force
Else
Write-Host "Current user policy was already" $CurrentUser ", making no changes."
if ($LocalMachine -like "Restricted" -or $LocalMachine -like "Undefined")
Write-Host "Local Machine policy was " $LocalMachine ", changing it to Remote Signed."
Set-ExecutionPolicy RemoteSigned -Scope LocalMachine -Force
Else
Write-Host "Local Machine policy was already" $LocalMachine ", making no changes."

In general no. Compliance settings is designed explicitly for what you said, thumbs up or thumbs down.
To collect data, you need to take advantage of hardware inventory's ability to easily pull information from WMI.
In combination then, you could use compliance settings (via a script) to populate the data in WMI and then HW Inv to collect the data.
Jason | http://blog.configmgrftw.com

Similar Messages

  • How can I get Data from the Sound cart in Labview? Does a VI exist?

    How can I get Data from the Sound cart in Labview? Does a VI exist?

    Yes, there are VIs for acquiring data from Sound cards. And examples too. If you don't have LabVIEW yet, do a search on NI's site for example VIs.
    Khalid

  • How can i get data from another database SQL Server use database link from

    I have a database link from Oracle connect to SQL Server database with user cdit connect default database NorthWind.How can I get data from another database(this database in this SQL Server use this database link)?

    hi,
    u should see following documentation:
    Oracle9i Heterogeneous Connectivity Administrator's Guide
    Release 1 (9.0.1)
    Part Number A88789_01
    in it u just go to chapter no. 4 (using the gateway),,u'll find ur answer there.
    regards
    umar

  • How can i get data from a maintance view?

    Hi all.
        Can you give me some suggestion about 'How can i get data from a maintance view?'?
         Thanks
         Best regard

    hi
    good
    go through this link
    http://help.sap.com/saphelp_nw04/helpdata/en/cf/21ecdf446011d189700000e8322d00/content.htm
    thanks
    mrutyun^

  • After I restored my ipad I chose itunes restore. now how can I get my info of which is backed up from icloud?.

    hi all!
    Reseting ipad, we are asked to restore info from icloud or itunes. If we choose icloud, the info will be restored, but the apps on the ipad should be downloaded from app. store! because icloud can't save the applications. and If we choose to restore with itunes, the apps will be loaded quickly ,But still we need our info in icloud. and if we go to icloud backup , from ipad settings, we just have one choice: back up now! that backs up the new info, not our backed up info. but we need our backed up info.
    After I restored my ipad I chose itunes restore. now how can I get my info of which is backed up from icloud?

    bechosken wrote:
    My friend wanted to get some music off my itunes
    This is called "stealing". You do not have the legal right to give her the music you have in your iTunes library unless you are the copyright holder.
    when syncing it it said she had to update her phone software first
    That's not quite what it said.  Someone should have paid more attention to the great big warning about the possibility of losing data if the phone wasn't backed up.
    We cannot find her new photos. Please help and there was 100 new pics. Is there any way we can get them back. I already have the program Asoftech - but it doesnt seem to register the iphone only C and D drive. Please help!
    It restored the backup that was made on your computer 6 months ago, which did not contain those photos. You're wasting your time trying to find them on the phone. They don't exist.
    Hopefully, your friend syncs her phone to her own computer on a regular basis. She needs to plug her phone into her computer and restore it from her last backup. That will restore it to the state it was in when the backup was made.
    She also needs to get in the habit of extracting the photos on a regular basis, like she would from any other digital camera.

  • How can I get my itunes library back onto my laptop from my ipad

    How can I get my itunes library back onto my laptop from my ipad?

    Here is one way: http://www.copytrans.net/copytransmanager.php Google for more.
    Why isn't the library on your computer?

  • How can I get my apple tv to stream my music from iTunes Match

    How can I get my apple tv to stream my music from iTunes Match

    am already a subscriber of ITunes Match and all my collection has been matched but it will not stream to AppleTV  how can I correct this error all I am getting is the whirling wheel

  • How can I get a family member back after being removed from family share?

    How can I get a family member back after being removed from family share?

    See [[Replace your Sync information]] but read the cautions carefully.
    * also see [[firefox Sync is not working]]
    It is always a useful precaution to make manual bookmarks backups
    * see [[Backing up and restoring bookmarks]]
    The above article also explains about the autobookmark backups that firefox generates, but be sure to make manual backups as you work, it is very easy to overwrite the wrong set of backups.
    I am not entirely certain what firefox is doing in your case, perhaps the synced Netbook does not have the expected set of bookmarks on it.
    Presumably sync may be uninstalled or disabled like any other add-on
    *see [[Uninstalling add-ons]]

  • How can I get the attributes details like user name, mail , from sAMAccount csv or notepad file through powershell or any other command in AD?

    How can I get the attributes details like user name, mail , from sAMAccount csv or notepad file through powershell or any other command in AD?

    Ok what about If i need to get all important attributes by comparing Email addresses from excel file and get all required answers
    currently I am trying to verify how many users Lines are missing , Emp numbers , Phones  from AD with HR list available to me.
    I am trying to Scan all the AD matching HR Excel sheet and want to search quickly how many accounts are active , Line Managers names , Phone numbers , locations , title , AD ID .
    these are fields I am interested to get in output file after scanning Excel file and geting reply from AD in another Excel or CSV file
    Name’tAccountName’tDescri ption’tEma I IAddress’tLastLogonoate’tManager’tTitle’tDepartmenttComp
    any’twhenCreatedtAcctEnabled’tGroups
    Name,SamAccountName,Description,EmailAddress,LastLogonDate,Manager,Title,Department,Company,whenCreated,Enabled,MemberOf | Sort-Object -Property Name
    Can you modify this script to help me out :)
    Hi,
    Depending on what attributes you want.
    Import-Module ActiveDirectory
    #From a txt file
    $USERS = Get-Content C:\Temp\USER-LIST.txt
    $USERS|Foreach{Get-ADUser $_ -Properties * |Select SAMAccountName, mail, XXXXX}|Export-CSV -Path C:\Temp\USERS-ATTRIBUTES.csv
    #or from a csv file
    $USERS = Import-CSV C:\Temp\USER-LIST.csv
    $USERS|Foreach{Get-ADUser $_.SAMAccountName -Properties * |Select SAMAccountName, mail, XXXXX}|Export-CSV -Path C:\Temp\USERS-ATTRIBUTES.csv
    Regards,
    Dear
    Gautam Ji<abbr class="affil"></abbr>
    Thanks for replying I tried both but it did not work for me instead this command which i extended generated nice results
    Get-ADUser -Filter * -Property * | Select-Object Name,Created,createTimeStamp,DistinguishedName,DisplayName,
    EmployeeID,EmployeeNumber,Enabled,HomeDirectory,LastBadPasswordAttempt,LastLogonDate,LogonWorkstations,City,Manager,MemberOf,MobilePhone,PasswordLastSet,BadLogonCount,pwdLastSet,SamAccountName,UserPrincipalName,whenCreated,whenChanged
    | Export-CSV Allusers.csv -NoTypeInformation -Encoding UTF8
    only one problem is that Manager column is generating this outcome rather showing exact name of the line Manager .
    CN=Mr XYZ ,OU=Users,OU=IT,OU=Departments,OU=Company ,DC=organization,DC=com,DC=tk

  • I used to have eight genius mixes and now I have four...I changed the genres around and nothing happened...I've added many more songs since it changed from 8 to 4 mixes...how can I get more again and why did it go from 8 to 4?

    I used to have eight genius mixes and now I have four...I changed the genres around and nothing happened...I've added many more songs since it changed from 8 to 4 mixes...how can I get more again and why did it go from 8 to 4? I had the Hardcore mix and a rap mix and classic rock and grunge mixes...now I don't...I kinda want those back...the mixes I have now make no sense as most the songs on each do not correlate AT ALL to the genre mix they have been placed in. If someone could give me an answer that'd be great.

    1. Don't confuse "Apple ID" with iTunes Account ID.  You can have many Apple IDs but only one iTunes account active at a time.
    2. If you "changed" your iTunes account ID, you actually have 2 accounts - one under the old name plus the new name.
    3. You can't merge the accounts - they remain separate.  Apps purcahsed under the old account name will update ONLY WHEN THE PHONE IS SIGNED IN TO THE OLD ACCOUNT NAME  and visa versa.
    4. Likewise, you can sync only the apps, music, media purchased under the account the phone AND iTunes are signed in to.

  • I had to reset my ipad and 3 mivies rented dissapear. how can I get it again if i have not watched yet?

    I had to reset my ipad and 3 movies rented dissapear. how can I get it again if i have not watched yet?

    You can try contacting iTunes support and see if they will grant you a  re-download of them : http://www.apple.com/support/itunes/contact/ - click on Contact iTunes Store Support on the right-hand side of the page, then Purchases, Billing & Redemption

  • HT1365 How can I get my iPhone 4 to update my updates from my app store of it keeps telling me error 3150 or it tell me to refresh the page after updates and the updates are still there asking me to update them again

    How can I get my iPhone 4 to update my updates from my app store of it keeps telling me error 3150 or it tell me to refresh the page after updates and the updates are still there asking me to update them again?

    Make sure iTunes on the computer is logged into the account on the phone.
    Plug the iPhone in.
    In the popup window warning about wiping your phone, hit cancel.
    In the left pane of iTunes, the phone icon should be there.
    Right click on it, select transfer purchases.
    Note: this will only transfer music bought from iTunes. Not mp3's from amazon or ripped from CD's.

  • I have purchase iphone4 from someone,it is not factory unlock ,how can i get it factory unlock,its safari not working and its not showing drive on my computer

    i have purchase iphone4 from gray market,it is not factory unlock,how can i get it factory unlock,
    its safari not working and it is not showing drive in my computer.

    iPhones are sold in carrier-locked and unlocked versions. If the phone has a carrier lock on it, you must contact the carrier to have it removed (you probably need to bring the phone to the carrier for the process). If you don't know the carrier, you won't be able to get it unlocked. US carriers will not remove the carrier lock and it cannot be removed.
    How is Safari behaving that makes you say that Safari is not working? The lock status of the phone won't affect Safari, except that if the phone is locked and you aren't using the carrier (and SIM provided by the carrier) to which it is locked, then you can't use the phone or 3G service, only Wi-Fi.
    The iPhone should not appear as a drive on your computer, so there's no error there.

  • How can i get my hp office jet j4550 to print from word 7?

    How can I get my HP Office Jet j4550 to print from the Microsoft Word 7? I downloaded the drivers for the printer and reinstalled Microsoft Word 7. 

    Do you mean Windows 7?
    ======================================================================================
    * I am an HP employee. *
    ** Make it easier for other people to find solutions, by marking my answer with "Accept as Solution" if it solves your issue. **
    ***Click on White “Kudos” STAR to say thanks!***

  • How can I transfer all my music even music not downloaded from iTunes to my computer

    How can I transfer all my music even music not downloaded from iTunes to my computer from my iPhone

    Paddy7 wrote:
    How can I transfer all my music even music not downloaded from iTunes to my computer from my iPhone
    See Here  >  https://discussions.apple.com/docs/DOC-3141

Maybe you are looking for

  • Always get an error message when installing airport extreme. Can not figure out why.

    Hi. I purchased four months ago a new airport extreeme base station in apple store in Amsterdam. I connected the router to the airport extreeme And orange light flashed from it. I went to the wifi menu and chose from a list of available networks in a

  • Has anyone else lost all of their in app purchases?

    After i have updated to iOS5, I lost all of my In app game purchases. Is there any way of getting them back?

  • F.19 show accrual amount, how to clear it?

    Hi, I come across with an issue. We wrongly posted an debit note to vendor. It supppose to post an invoices to system. We have done payment and bank recon, it no possible to reverse the Debit note. This amount is hang at accrual there. F.19 is still

  • Collection in source system ended

    Hi Experts, Need your help on the below issue. Due to error at R/3 the status of my load for one of the infosource is YELLOW with status: Collection in source system ended. The Request (REQU_4CXV37IJY08OX4UVF4YCPREAR) in R/3 under SM37  is Completed

  • CONTENT NOT ALLOWED IN PROLONG

    HI, I AM doing simple file2file senario in SXMB_MONI its showing redflag and i tested the source code in testing its showing the following error CONTENT NOT ALLOWED IN PROLONG Regards, Prasad