Skip to content

Instantly share code, notes, and snippets.

$TypeQuery = sc.exe query winmgmt|Select-String -Pattern "TYPE" -SimpleMatch
$type = $TypeQuery.ToString().Trim().Split(':')[1].trim().split(' ')[0]
$type
$logs = Get-ChildItem -Path C:\inetpub\logs -Recurse -Filter *.log
$oldest = (get-date).AddDays(-30)
foreach($log in $logs){
if($log.LastWriteTime -lt $oldest){
$log.Delete()
}
}
<?xml version="1.0" encoding="utf-8"?>
<unattend xmlns="urn:schemas-microsoft-com:unattend">
<settings pass="oobeSystem">
<component name="Microsoft-Windows-Shell-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State">
<OOBE>
<HideWirelessSetupInOOBE>true</HideWirelessSetupInOOBE>
<NetworkLocation>Work</NetworkLocation>
<SkipMachineOOBE>true</SkipMachineOOBE>
<SkipUserOOBE>true</SkipUserOOBE>
</OOBE>
@mrbodean
mrbodean / publish_cert2wmi.ps1
Created July 24, 2018 19:42
Script to show how to collect certificate data and publish it to WMI
<#Disclaimer
The sample scripts are not supported under any Microsoft standard support program or service.
The sample scripts are provided AS IS without warranty of any kind. Microsoft further disclaims all implied warranties including, without limitation, any implied warranties of merchantability or of fitness for a particular purpose.
The entire risk arising out of the use or performance of the sample scripts and documentation remains with you.
In no event shall Microsoft, its authors, or anyone else involved in the creation, production, or delivery of the scripts be liable for any damages whatsoever (including, without limitation, damages for loss of business profits, business interruption, loss of business information, or other pecuniary loss) arising out of the use of or inability to use the sample scripts or documentation, even if Microsoft has been advised of the possibility of such damages.
#>
## Delete any existing instances
$CurrentEA = $ErrorActionPreference
$ErrorActionPreference = 'Silent
Param(
[string]$WsusServer = ([system.net.dns]::GetHostByName('localhost')).hostname,
[bool]$UseSSL = $False,
[int]$PortNumber = 80
)
$script:CurrentErrorActionPreference = $ErrorActionPreference
$ErrorActionPreference = "SilentlyContinue"
#Connect to the WSUS 3.0 interface.
[reflection.assembly]::LoadWithPartialName("Microsoft.UpdateServices.Administration") | out-null
# Author: Garth Jones
# http://www.enhansoft.com
#
# Created Date: 2016-08-01
# Version: 1.00
#
# Thanks Sean Kearney @energizedtech for the start point.
#
##################################################################
oldname1.test|newname1.test
oldname2.test|newname2.test
oldname3.test|newname3.test
oldname4.test|newname4.test
oldname5.test|newname5.test
oldname6.test|newname6.test
<?xml version="1.0" encoding="UTF-8"?>
<Benchmark>
<title>APACHE SITE 2</title>
</Benchmark>
<check_type>
<custom_item>
system : "Linux"
type : "Check"
description : "8.1.1.1 this is other text"
</custom_item>
<custom_item>
system : "Linux"
type : "Check"
description : "8.1.1.1 more text"
AssignedCIs = {"<?xml version='1.0' ?>\n\t\t<CI>\n\t\t\t<ID>8f8f54bb-05de-44a8-8695-f5d06d06d20f</ID>\n\t\t\t<ModelName>Site_56FE87C5-F355-45F9-BE43-BE8D575809F4/SUM_8f8f54bb-05de-44a8-8695-f5d06d06d20f</ModelName>\n\t\t\t<Version>1.00</Version>\n\t\t\t<CIVersion>200</CIVersion>\n\t\t\t<ApplicabilityCondition>\n\t\t\t\t<ApplicabilityRule ExpressionLanguage=\"Custom\" Handler=\"{2DB70103-3DFB-4806-85B0-B27B561284BB}\"><UpdateId>8f8f54bb-05de-44a8-8695-f5d06d06d20f</UpdateId><CISource><Id>{56FE87C5-F355-45F9-BE43-BE8D575809F4}</Id><Version>218</Version></CISource><ProductId>041e4f9f-3a3d-4f58-8b2f-5e6fe95c4591</ProductId></ApplicabilityRule>\n\t\t\t</ApplicabilityCondition>\n\t\t\t<EnforcementEnabled>FALSE</EnforcementEnabled>\n\t\t\t<DisplayName>Update for Microsoft Office Outlook 2007 Junk Email Filter (KB3114544)</DisplayName>\n\t\t\t<UpdateClassification>e6cf1350-c01b-414d-a61f-263d14d133b4</UpdateClassification>\n\t\t</CI>", "<?xml version='1.0' ?>\n\t\t<CI>\n\t\t\t<ID>92ff382f-1b20-416f-9bae-2887ca1682ff<