Thursday 23 April 2020

Jenkins service reinstall

I have not investigated more but it seems Jenkins does not like Java update. Sometimes the windows service fails to start. The simplest seems to remove it and install again...

sc delete jenkinsslave-D__Jenkins

Monday 24 February 2020

Images used in web project

I am doing little clean-up in the project. Need to identify what images are still used and the rest I would like to remove. This PowerShell script helps to identify images which are used in any page, user control or c# code.

For each in the application is executed command which tries to find its name in all files matching given pattern.


@(Get-ChildItem 'D:\WebApp\images') | 
    ForEach-Object { 
        $_.name | Write-Host -NoNewline
        Write-Host ' ' -NoNewline
        
        dir 'D:\WebApp' -I *.aspx,*.ascx,*.cs,*.master -R | 
            Select-String $_.name -Quiet | where  {$_ -eq $true} | Write-Host -NoNewline
        
        Write-Host #writes a new line
    }