If a trailing asterisk (*) isn't included in the Path parameter, the contents of the Path parameter are displayed. The exceptions are filenames or subdirectory names that match the Exclude parameter's value.
PS C:\> Get-ChildItem -Path c:\ -Exclude "Windows"
PS C:\> Get-ChildItem -Path c:\ -Include "Windows*"
PS C:\> Get-ChildItem -Path c:\* -Include "Windows*"
Каталог: C:\Windows
Mode LastWriteTime Length Name
---- ------------- ------ ----
-a---- 05.12.2023 8:51 276 WindowsUpdate.log
PS C:\> Get-ChildItem -Path c:\ -Include "WindowsUpdate*"
PS C:\> Get-ChildItem -Path c:\* -Include "WindowsUpdate*"
PS C:\> Get-ChildItem -Path c:\windows -Include "*.log"
PS C:\> Get-ChildItem -Path c:\windows\* -Include "*.log"
Каталог: C:\windows
Mode LastWriteTime Length Name
---- ------------- ------ ----
-a---- 20.11.2020 16:57 762 comsetup.log
-a---- 02.06.2021 9:17 89672 iis.log
-a---- 24.10.2023 14:23 4984 setupact.log
-a---- 20.11.2020 16:52 0 setuperr.log
-a---- 05.12.2023 8:51 276 WindowsUpdate.log
$f1 = [pscustomobject]@{
field1 = 'f1'
}
$f2 = @(
[pscustomobject]@{
field1 = 'f11'
field2 = 'f21'
}
[pscustomobject]@{
field2 = 'f22'
}
[pscustomobject]@{
field2 = 'f23'
}
)
$f1 #| out-host
#'aaa' | out-host
'bbb' | format-list
'ccc'
$a = read-host
#$f2
#$f2 | %{ $_ }
$f2 | out-host
'ddd'
$f1=...
и $f2=...
добавить dir d:\
, внезапно выводится всё. даже без | out-host
$cnDB
добавьте это последней строкой
а в Insert-DB Надо добавить соответствующий параметр
$Connection
и именно его использовать вместо
$cnDB
и, кстати,
.Close()
не делать в Insert-DB, зачем коннект закрывать?ну и вызов Insert-DB внутри цикла ведь нужен, нет ?