Skip to content

Instantly share code, notes, and snippets.

View Curtmcgirt's full-sized avatar

John P Curtiss Curtmcgirt

View GitHub Profile
$MP = "Microsoft.Windows.Server.2003"
$path = "C:\folder\XML.to.Clean.Up.xml"
$xml = [xml](get-content $path)
$references = $xml.ManagementPack.Manifest.References.Reference | ? id -like "*$mp*"
foreach($reference in $references)
{$references.parentnode.RemoveChild($reference)}
$Diagnostics = $xml.ManagementPack.Monitoring.diagnostics.diagnostic | ? target -like "*$mp*"
foreach($Diagnostic in $Diagnostics)
<?xml version="1.0" encoding="utf-8"?><ManagementPack ContentReadable="true" SchemaVersion="2.0" OriginalSchemaVersion="1.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<Manifest>
<References>
<Reference Alias="Windows3">
<ID>Microsoft.Windows.Server.2003</ID>
<Version>6.0.6989.0</Version>
<PublicKeyToken>31bf3856ad364e35</PublicKeyToken>
</Reference>
</References>
#v4
Measure-Command { foreach($source in $sources)
{
$sourcepath = $source.path.replace('\','/')
$count = $allstats.sourcefilename.Where({$_ -like "*$sourcepath*"}).count
$array += [pscustomobject]@{count = $count; path = $source.path}
}
}
#v5
#v2
Measure-Command {foreach($source in $sources)
{
$count = 0
foreach($allstat in $allstats)
{
$sourcepath = $source.path.replace('\','/')
if($allstat.sourcefilename -like "*$sourcepath*")
{
$count++
foreach($source in $sources)
{
$sourcepath = $source.path.replace('\','/')
$count = ($allstats | ? sourcefilename -like "*$sourcepath*").count
$array += [pscustomobject]@{count = $count; path = $source.path}
}
@Curtmcgirt
Curtmcgirt / sample.xml
Created August 16, 2019 01:48
sample xml
<settings>
<hosts>
<FTP ID="459" Name="*Test Prod FTP" > </FTP>
<SSHFTP ID="741" Name="*Test UA SSH" > </SSHFTP>
<Share ID="832" Name="\\server\share" > </Share>
<FTP ID="451" Name="*Test FTP" > </FTP>
@Curtmcgirt
Curtmcgirt / testrdg.rdg
Created November 7, 2018 21:20
rdg xml
<?xml version="1.0" encoding="utf-8"?>
<RDCMan programVersion="2.7" schemaVersion="3">
<file>
<credentialsProfiles />
<properties>
<expanded>True</expanded>
<name>testrdg</name>
</properties>
<group>
<properties>