:::: MENU ::::
Browsing posts in: Uncategorized

Powershell Script for Installed driver details to export



param(
    [string]$outputFile
)

$dateTimeString = $(get-date -UFormat '%Y-%m-%d_%T.%S').Replace(':','')
if (! ($outputFile)) {
    $outputFile = "c:\temp\$($env:computername)--PnpSignedDrivers--$($dateTimeString).csv"
}

#$netBackupShare = '\\SHARE\PnPSignedDrivers'

$deviceIdIgnoreList= @(
    'Send To OneNote 2013',
    'WebEx Document Loader',
    'HTREE\ROOT\0',
    'Fax',
    'Microsoft Print to PDF',
    'Microsoft XPS Document Writer'
);

$selectObjectList = @(
    'DeviceClass',
    'Manufacturer',
    'DriverVersion',
#'DriverDate',
    @{Label='DriverDate';Expression={$_.ConvertToDateTime($_.DriverDate)}},
    'Description',
    'DeviceName',
    'FriendlyName',
    'CompatID',
    'DeviceID',
    'HardWareID',
    'DevLoader',
    'DriverName',
    'DriverProviderName',
    'InfName',
    'InstallDate',
    'IsSigned',
    'Signer'
);

Write-Host ''
Write-Host 'Pulling PnP Signed Drivers from WMI ...'
$wmiClass = 'Win32_PnPSignedDriver'
$drivers = Get-WmiObject $wmiClass | 
    Where-Object { !($deviceIdIgnoreList.Contains($_.DeviceID)) } |
    Select-Object $selectObjectList |
        Sort-Object Manufacturer,DeviceClass,Description

if ($drivers) {
    Write-Host ''
    Write-Host 'Exporting results to .CSV ...'
        $drivers | Export-Csv -Path $outputFile

    Write-Host '--> Cleaning up .CSV ...'
    $fileBuffer = Get-Content -Path $outputFile | Select -Skip 1
    Set-Content -Path $outputFile -Value $fileBuffer

    Write-Host ''
    Write-Host "Final output file is located at:`r`n   `"$($outputFile)`""

   # Copy-Item $outputFile "$($netBackupShare)\"
#    Write-Host ''
   # Write-Host "File has also been backed up to:`r`n   $($netBackupShare)\"
} else {
    Write-Host ''
    Write-Host "No driver '$($wmiClass)' was found."
}



CCM repair

#Stop and remove ccm service
& sc stop ccmsetup
& sc delete ccmsetup

#Remove ccm certs
Remove-Item ‘HKLM:\SOFTWARE\Microsoft\SystemCertificates\SMS\Certificates\*’ -Force

#Remove ccm files
Remove-Item -Path $env:windir\ccm -Recurse -Force
Remove-Item -Path $env:windir\system32\ccm -Recurse -Force
Remove-Item -Path $env:windir\ccmcache -Recurse -Force
Remove-Item -Path $env:windir\ccmsetup -Recurse -Force
Remove-Item -Path $env:windir\system32\ccmsetup -Recurse -Force
Remove-Item -Path $env:windir\smscfg.ini -Force
Remove-Item -Path $env:windir\sms*.mif -Force

#Remove ccm registry keys
$RegRoot = “HKLM:\Software\Microsoft”
Remove-Item -Path “$RegRoot\ccm” -Recurse -Force
Remove-Item -Path “$RegRoot\ccmsetup” -Recurse -Force
Remove-Item -Path “$RegRoot\sms” -Recurse -Force

#Remove ccm wmi namespaces
Get-WmiObject -Query “SELECT * FROM __Namespace WHERE Name=’CCM'” -Namespace “root” | Remove-WmiObject
Get-WmiObject -Query “SELECT * FROM __Namespace WHERE Name=’SMS'” -Namespace “root\cimv2” | Remove-WmiObject

#Repair WMI
$Path = ‘C:\Windows\System32\wbem’
Stop-Service -Name Winmgmt -Force
Remove-Item “$Path\repository” -Recurse -Force
& wmiprvse /regserver
Start-Service -Name Winmgmt
Get-ChildItem $Path -Filter *.dll | ForEach-Object { & regsvr32.exe /s $_.FullName } | Out-Null
Get-ChildItem $Path -Filter *.mof | ForEach-Object { & mofcomp.exe $_.FullName } | Out-Null
Get-ChildItem $Path -Filter *.mfl | ForEach-Object { & mofcomp.exe $_.FullName } | Out-Null
& mofcomp.exe ‘C:\Program Files\Microsoft Policy Platform\ExtendedStatus.mof’ | Out-Null


%Office% SQL


SELECT DISTINCT  
  SYS.Name0
  ,ARP.DisplayName0 As 'Software Name'
  ,ARP.Version0 As 'Version'
  ,ARP.InstallDate0 As 'Installed Date'
 FROM 
  dbo.v_R_System As SYS
  INNER JOIN dbo.v_FullCollectionMembership FCM On FCM.ResourceID = SYS.ResourceID 
  INNER JOIN dbo.v_Add_REMOVE_PROGRAMS As ARP On SYS.ResourceID = ARP.ResourceID 
 WHERE   
 (ARP.DisplayName0 LIKE '%Microsoft % Standard%'
 OR ARP.DisplayName0 LIKE 'Microsoft % Professional%'
 OR ARP.DisplayName0 LIKE 'Microsoft % Enterprise %')
 ORDER BY Name0 ASC


Using Machine – OutPut :-User Name,AD site code,AD discoverd date,Active Client,Client Status,Obsolete Client,HW SCAN DIFFERENCE

SELECT Name0 AS [Machine Name], User_Name0 AS [User Name],AD_site_name0 as [AD site code] ,creation_date0 as [AD discoverd date],
CASE Active0 WHEN ‘0’ THEN ‘InActive’ WHEN ‘1’ THEN ‘Active’ ELSE ‘Unknown’ END AS [Active Client],

CASE Client0 WHEN ‘0’ THEN ‘No’ WHEN ‘1’ THEN ‘Yes’ ELSE ‘Unknown’ END AS [Client Status],

CASE obsolete0 WHEN ‘0’ THEN ‘No’ WHEN ‘1’ THEN ‘Yes’ ELSE ‘Unknown’ END AS [Obsolete Client], DATEDIFF(D,V_GS_WORKSTATION_STATUS.LASTHWSCAN,GETDATE()) AS [HW SCAN DIFFERENCE]

FROM v_R_System LEFT JOIN V_GS_WORKSTATION_STATUS ON V_R_SYSTEM.RESOURCEID = V_GS_WORKSTATION_STATUS.RESOURCEID

WHERE (Name0 IN (‘XXXXX’,’SSS’))


SQL LeftJoin Template

Select Name, [Disk_Space] from

(Select * From V_FullcollectionMembership where CollectionID = ‘ XXXX’ ) AllMachines

LeftJoin
( XXXXXXX  ) DiskSpace

On AllMachines.Name=Diskspace.[Computer Name]

____________________________________________________________
Example :—
______

select Name, [DISK_SPACE]
from
(select *
from v_FullCollectionMembership
where collectionID = ‘XXX00BB5’) allMachines
left join
(SELECT DISTINCT
v_R_System.Netbios_Name0 AS [Computer Name], v_R_System.User_Name0 as [ User name],
DisplayName AS [Baseline Item],
v_StateNames.StateName AS [Baseline Status],

case v_StateNames.StateName when ‘Compliant’ then ‘Yes’ when ‘Non-Compliant’ then ‘No’ when ‘Unknown’ then ‘Unknown’ when ‘Error’ then ‘Error’ ELSE v_StateNames.StateName END AS [DISK_SPACE]

FROM   dbo.v_CICurrentComplianceStatus INNER JOIN
dbo.v_CIAssignmentToCI ON v_CICurrentComplianceStatus.CI_ID = v_CIAssignmentToCI.CI_ID INNER JOIN
dbo.v_CIAssignment ON v_CIAssignmentToCI.AssignmentID = v_CIAssignment.AssignmentID INNER JOIN
dbo.v_LocalizedCIProperties ON v_CICurrentComplianceStatus.CI_ID = v_LocalizedCIProperties.CI_ID INNER JOIN
dbo.v_StateNames ON v_CICurrentComplianceStatus.ComplianceState = v_StateNames.StateID INNER JOIN
dbo.v_R_System ON v_CICurrentComplianceStatus.ResourceID = v_R_System.ResourceID INNER JOIN
dbo.v_FullCollectionMembership ON dbo.v_R_System.ResourceID = dbo.v_FullCollectionMembership.ResourceID
WHERE (v_StateNames.TopicType = 401) AND (v_CIAssignment.CollectionID = ‘XXX00B86’)
AND (dbo.v_FullCollectionMembership.CollectionID = ‘XXX00B86’)
and ( dbo.v_LocalizedCIProperties.DisplayName = ‘Machines With Low Disk Space (Less Than 10GB)’)
) DiskSpace
on allMachines.Name = DiskSpace.[Computer Name]


SCCM ConfigMgr 1610 Recover from Regular SCCM Maintenance Backup Folder

Unlike Old other version of SCCM it’s not supported recover wizard from SCCM software media SCCM Site recover wizard. We have to Drill down, SCCM Backup Folder CD>LATEST then launch the setup.hta for recover the SCCM Site. Below are the step by step details.

So its for same if you want to move your SCCM system to New Box or Crashed your SCCM server you want to recover from SCCM Backup Scenarios.

 

Assuming SCCM Server Name = MYSCCM

 

  • Install the Operating system server OS
  • Change the System Name to “MYSCCMNew”
  • Join into Domain
  • Install the Pre-requirements like IIS,SQL,ADK,features(BITS, remote deferential ),etc
  • Copy all data from your MYSCCM to MYSCCMNEW with similar Folder structure with same permissions better to use Robocopy.(Folder structure it includes the SCCM Installation Drive)
  • Once you copy all data includes your SCCM Maintenance Task Scheduler back (which includes CD.LATEST) change the system name to MYSCCM just like old SCCM Server. At that time make you sleep the OLD SCCM server to Avoid the duplicate machine record
  • Then launch the setup.hta from backup folder and follow the regular wizards
  • You can able to recover the TS, Apps, Collections all your settings.
  • But once you recovered the Site again try to run the AD Schema Extension to be on safe side.
  • And update all Applications, Packages ,Boot files,etc
  • You may face Image certificate issue, Please re issue the certificate to work includes pxe and create new offline media

Difference between Inactive and Obsolete

Inactive clients are clients that haven’t checked in via heartbeat.

Obsolete clients are clients that have been replaced by other clients. Maybe duplicates, or clients that have been replaced by a new client from OSD, etc

 

For more details

http://systemcentersupport.blogspot.in/2010/01/what-is-difference-between-obsolete-and.html


Windows Updates Classification

 

Service Packs

A service pack is a periodic update that corrects problems in one version of a product. In addition to correcting known problems, service packs provide tools, drivers, and updates that extend product functionality, including enhancements developed after the product was released.

 

Updates

Updates are code fixes for products that are provided to individual customers when those customers experience critical problems for which no feasible workaround is available.

 

Security Updates

Security updates address security vulnerabilities. Attackers wanting to break into systems can exploit such vulnerabilities. Security updates are analogous to updates, but should be considered mandatory, and they must be deployed quickly.

 

 

 

Critical updates Broadly released fixes for specific problems addressing critical, non-security related bugs.
Definition updates Updates to virus or other definition files.
Drivers Software components designed to support new hardware.
Feature packs New feature releases, usually rolled into products at the next release.
Security updates Broadly released fixes for specific products, addressing security issues.
Service packs Cumulative sets of all hotfixes, security updates, critical updates, and updates created since the release of the product. Service packs might also contain a limited number of customer-requested design changes or features.
Tools Utilities or features that aid in accomplishing a task or set of tasks.
Update rollups Cumulative set of hotfixes, security updates, critical updates, and updates packaged together for easy deployment. A rollup generally targets a specific area, such as security, or a specific component, such as Internet Information Services (IIS).
Updates Broadly released fixes for specific problems addressing non-critical, non-security related bugs.

 


Pages:123