Friday, January 24, 2020

Update DICOM tags with PowerShell



Using the dicom PowerShell Module



Get the DICOM Powershell Module
https://www.powershellgallery.com/packages/Dicom/1.0.10.0


Powershell Script
================================================
# Update DICOM file TAGS

# Use this command to install Dicom Module - Install-Module -Name Dicom


$curpath = $(Get-Location).Path
$targetFolder = $curpath + "\*.dcm"
$dcmfiles = Get-ChildItem $targetFolder

# Series Description Tag Names Hash table
        $seriesDescriptionS = @{
            LAP='Leg Full Left AP (Stitched)'
            LL='Leg Full Left Lat (Stitched)'
            RAP='Leg Full Right AP (Stitched)'
            RL='Leg Full Right Lat (Stitched)'
        }



#Process targeted dicom files

ForEach ($dcmfile in $dcmfiles) {

$dicomfile = Import-dicom -Filename $dcmfile
$dicom = Read-Dicom -DicomFile $dicomfile
$dicom.SeriesDescription
$PatientID=$dicom.PatientID
$newseriesDescription = $seriesDescriptionS.($dcmfile.BaseName.ToUpper())
$tempfolder = "c:\support\dcmtemp"
# Look for file names with ll,rl,rap, or rl to processs and insert tags
    if ($newseriesDescription) {


    edit-dicom -DicomFile $dicomfile -Tag "0018,1164" -Value '0.150000\0.150000'
    edit-dicom -DicomFile $dicomfile -Tag "0008,103e" -Value $newseriesDescription
    Export-Dicom -DicomFile $dicomfile -DestinationPath $tempfolder
    $tempfile = $tempfolder + "\DICOM\0000001"
    $targetFile = $curpath + "\" + $PatientID + "-" +$dcmfile.BaseName.ToUpper() + "s.dcm"
    $targetFile
    Copy-Item -Path $tempfile -Destination $targetFile


    }
}

Remove-Item $tempfolder -Force  -Recurse -ErrorAction SilentlyContinue

Thursday, January 23, 2020

Check if LLMNR is disabled with PowerShell

Check if LLMNR Is disabled with PowerShell

Get-ItemProperty -Path "HKLM:\Software\Policies\Microsoft\Windows NT\DNSClient" -name EnableMulticast


If it returns an error then it is not set.



example

PS C:\support\scripts> Get-ItemProperty -Path "HKLM:\Software\Policies\Microsoft\Windows NT\DNSClient" -name EnableMulticast


EnableMulticast : 0
PSPath          : Microsoft.PowerShell.Core\Registry::HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows
                  NT\DNSClient
PSParentPath    : Microsoft.PowerShell.Core\Registry::HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows NT
PSChildName     : DNSClient
PSDrive         : HKLM
PSProvider      : Microsoft.PowerShell.Core\Registry


Get Just the value

$(Get-ItemProperty -Path "HKLM:\Software\Policies\Microsoft\Windows NT\DNSClient" -name EnableMulticast).EnableMulticast

Returns 0 if disabled.