:::: MENU ::::



MY PS

$RESGUIDPATH = ‘HKLM:\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\{6C3683DE-A9F3-4BFA-BDF4-337860D52039}’

If((Test-Path $RESGUIDPATH) -eq $true){

$RESGUIDINFO = (Get-ItemProperty -Path $RESGUIDPATH)

If(($RESGUIDINFO.DisplayName -eq ‘RES ONE Workspace 2016 SR1 Agent’ `
-and $RESGUIDINFO.DisplayVersion -eq ‘9.12.1.0’) -or `
($RESGUIDINFO.DisplayName -eq ‘RES ONE Workspace 2016 SR1 Agent’ `
-and $RESGUIDINFO.DisplayVersion -eq ‘9.12.1.2’))

{Write-Host ‘Installed’}

Else {}

}

Else{}

#######################


Powershell Script – Get Add remove program entries

Get Add remove program entries from local or remote machines using Powershell in a CSV format-

function Get-Uninstall
{
param([parameter(Mandatory = $true)]$computer)
# paths: x86 and x64 registry keys are different

Start-Process "C:\windows\system32\sc.exe" -ArgumentList "\\$computer start winrm"

Invoke-Command -ComputerName $computer -ScriptBlock {
if ([IntPtr]::Size -eq 4) {
$path = 'HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall\*'
}
else {
$path = @(
'HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall\*'
'HKLM:\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\*'
)
}
# get all data
Get-ItemProperty $path |
# use only with name and unistall information
.{process{ if ($_.DisplayName -and $_.UninstallString) { $_ } }} |
# select more or less common subset of properties
Select-Object DisplayName, Publisher, InstallDate, DisplayVersion, HelpLink, UninstallString |
# and finally sort by name
Sort-Object DisplayName
}

Start-Process "C:\windows\system32\sc.exe" -ArgumentList "\\$computer stop winrm"
}

Get-Uninstall | Export-Csv -LiteralPath "$env:HOMEDRIVE\temp\ARP_Details.csv"-Force -NoTypeInformation



OS Installed Date > 10 Days


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 dateDiff(dd, SMS_G_System_OPERATING_SYSTEM.InstallDate, GetDate()) > 10

event viewer log export by event id


Set-Variable -Name EventAgeDays -Value 1 #we will take events for the latest 7 days
Set-Variable -Name CompArr -Value @("$env:COMPUTERNAME") # replace it with your server names
Set-Variable -Name LogNames -Value @("Application", "System") # Checking app and system logs
Set-Variable -Name ExportFolder -Value "c:\EWLogsbyEventID\" # change this yo your own location
$el_c = @() #consolidated error log
$now=get-date
if($ExportFolder){New-Item -Path $ExportFolder -ItemType Directory -Force}
$startdate=$now.adddays(-$EventAgeDays)
$ExportFile=$ExportFolder + "el" + $now.ToString("yyyy-MM-dd---hh-mm-ss") + ".csv" # we cannot use standard delimiteds like ":"

foreach($comp in $CompArr)
{
foreach($log in $LogNames)
{
Write-Host Processing $comp\$log
$el = get-eventlog -ComputerName $comp -LogName $log -After $startdate | where EventID -EQ 1000
$el_c += $el #consolidating
}
}
$el_sorted = $el_c | Sort-Object TimeGenerated #sort by time
Write-Host Exporting to $ExportFile
$el_sorted|Select EntryType, TimeGenerated, Source, EventID, MachineName, Message | Export-CSV $ExportFile -NoTypeInfo #EXPORT


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."
}