Create OPC Device Connection From Script

If you want example code, or want to skip having to write a script at all, you might find this Exchange project helpful:

Particularly if you want to make a bunch of tags and/or UDT instances to go with them.