I am trying to write a script to search my c:\ drive for all files that end in .pem. Once found I want to not only put them into a variable for use later in the script but also copy them into a directory. I think I am close the syntax but I am messing something up I am new to scripting with and any help is appreciated
Get-ChildItem -Path c:\ -Recurse -Name *.pem | Copy-item -Path c:\Program Files\files\
I've also tried this way as well