powershell - Batch script to find file -


i need batch script recursively find folder particular file in. have below powershell script works fine can't run due execution policy hence wondering if can me convert batch file please?


$val = get-itemproperty -path 'hklm:\software\microsoft\windows\currentversion\uninstall\{785a2e83-c8b2-46bb-8839-514de2243ead}' -name "displayname" -erroraction silentlycontinue  if($val.displayname -ne 'internet explorer 11') {   $ccmie11folders = @(get-childitem -path c:\windows\ccmcache -filter ie11-setup-full.msi -recurse)    if($ccmie11folders.count -gt 0)  {    & "$($ccmie11folders[0].directoryname)\install.cmd"    } } 

the script first looks registry item property. if not exist recursively finds file "ie11-setup-full.msi" under c:\windows\ccmcache folder. if found runs install.cmd resultant folder.

if wanted know, deploying ie11 in enterprise using sccm small percentage of them failing unknown reason trying re-run installer using script.

thanks in advance.

one alternative alter ps script conforms prevailing execution policy. sign script.

or, if script not remote, recreate script locally @ point of execution. if script stored locally on computer executed, it's still being considered remote, chances copied computer.

when faced this, created new empty .ps1 file notepad, opened old script notepad, copied whole thing clipboard , pasted new file. presto! new file no longer "remote". luck.


Comments

Popular posts from this blog

python - No exponential form of the z-axis in matplotlib-3D-plots -

php - Best Light server (Linux + Web server + Database) for Raspberry Pi -

c# - "Newtonsoft.Json.JsonSerializationException unable to find constructor to use for types" error when deserializing class -