Modul_Cleoni_Search.psm1
Function func_Searche($PID_Path, $Excelpath, $Keywords) { function Module-Install() { ################################################### If (!(Get-InstalledModule ImportExcel -ErrorAction SilentlyContinue)) { Install-Module -Name ImportExcel -Confirm:$false -AllowClobber -Force | Out-Null } Import-Module ImportExcel -Scope Global | Out-Null ################################################### } If (!(Test-Path -Path $PID_Path)) { New-Item -Path $PID_Path -ItemType Directory | out-null } $PID | Out-File -FilePath "$PID_Path\PID.txt" -Encoding utf8 -Force | out-null Module-Install $Resultlist = @() $worksheets = (Get-ExcelSheetInfo $Excelpath).Name Foreach ($worksheet in $worksheets) { Foreach ($entry in Import-Excel -Path $Excelpath -WorksheetName $worksheet) { #RESET LIST $Keywordlist = @() #SEARCH LIST Foreach ($Key in $Keywords) { If ($entry -match $Key) { $Keywordlist += $Key } } #Check and Add If ($Keywordlist.Count -eq $Keywords.count) { $Line = '' | Select Topic, Value $Line.Topic = $worksheet $Line.Value = $entry $Resultlist += $Line } } } return $Resultlist } |