So you need to specifically duplicate some items?
Then, more than layer change is required. (Layer and other parameter changes can be done across a library, given a suitable query; the operation cannot be undone, so save the library before doing it.)
I'm not familiar with the scripting engine, but I would suspect a copy-all, paste-all is not available on libraries; you'll have to iterate across all parts and do it. So, whatever calls are needed to enumerate or increment the current view, and select, duplicate and change objects in that view.
Tim