Script Memory and CPU settings

Is there a way to script setting both Memory and CPU settings?