Hi Thomas,
Below is a python snippet you can use to enable/disable the PSA:
import urllib, urllib2, json
username = "agsAdmin"
password = "gis12345"
tokenURL = 'http://<server.domain.com>:6080/arcgis/admin/generateToken/'
params = {'f': 'pjson', 'username': username, 'password': password, 'client': 'requestip'}
req = urllib2.Request(tokenURL, urllib.urlencode(params))
response = urllib2.urlopen(req)
data = json.load(response)
token = data['token']
psaURL = 'http://<server.domain.com>:6080/arcgis/admin/security/psa/enable'
params = {'f': 'pjson', 'token': token}
req = urllib2.Request(psaURL, urllib.urlencode(params))
response = urllib2.urlopen(req)
data = json.load(response)
print(data)
psaURL = 'http://<server.domain.com>:6080/arcgis/admin/security/psa/disable'
params = {'f': 'pjson', 'token': token}
req = urllib2.Request(psaURL, urllib.urlencode(params))
response = urllib2.urlopen(req)
data = json.load(response)
print(data)