vendredi 11 septembre 2015

Find file names containing value stored in a string variable or object and move that file

Hi Please help a Powershell newbie with a seemingly simple task which is doing my head in.

I have a folder containing a large list of hofixes. Each hotfix filename contains the KB number such as KB2993958 similar to Windows8.1-KB2957189-x64.msu

I'm trying to troubleshoot an issue caused by the installation of a particular hotfix. I have narrowed the selection down to about 50 possible hotfixes, far less than how many are contained in the master folder. I want to install 10 hotfixes at a time to try and isolate the issue.

I have the list of 50 hotfixes I need to install either in a get-hotfix object or probably converted to a string in a variable.

So I want to compare the Kb numbers listed in my object / variable against the file names in the master folder and if the file name contains any of the KB number stored in my variable then move this file into a folder, ready for installation. Seems simple. Can't work it out.

Please help. Feeling a bit dumb right now :( Many Thanks!!



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire