The Portal bean has couple of very important methods.
Portal.login: Once you start portal scripting interface first thing that you should do is call Portal.login('username','password') to login the user. You wont be able to access any of the scripting beans unless you login first.
If your getting 'Content bean not enabled' or Layout bean not enabled error then probably you have not logged in into portal yet.
portal.setvp: By default the portal scripting would work on the base portal. But if you want to modify or add page in particular virtual portal then call portal.setvp('urlcontent') method. Thereafter all your work on the scripting interface would be applied to the virtual portal.