Step 1: Differentiate the given function.
Given,
\[
f(x)=2x^3-9ax^2+12a^2x+1
\]
Differentiate with respect to \(x\):
\[
f'(x)=6x^2-18ax+12a^2
\]
Taking \(6\) common,
\[
f'(x)=6(x^2-3ax+2a^2)
\]
Factorizing,
\[
f'(x)=6(x-a)(x-2a)
\]
Step 2: Find critical points.
For maximum or minimum,
\[
f'(x)=0
\]
So,
\[
6(x-a)(x-2a)=0
\]
Hence,
\[
x=a \quad \text{or} \quad x=2a
\]
Step 3: Identify maximum and minimum points.
Now,
\[
f''(x)=12x-18a
\]
At \(x=a\),
\[
f''(a)=12a-18a=-6a
\]
Since \(a\gt 0\),
\[
f''(a)\lt 0
\]
Therefore, \(x=a\) is the point of maximum. Hence,
\[
p=a
\]
At \(x=2a\),
\[
f''(2a)=24a-18a=6a
\]
Since \(a\gt 0\),
\[
f''(2a)\gt 0
\]
Therefore, \(x=2a\) is the point of minimum. Hence,
\[
q=2a
\]
Step 4: Use the given condition.
It is given that
\[
p^2=q
\]
Substitute
\[
p=a
\]
and
\[
q=2a
\]
So,
\[
a^2=2a
\]
Since \(a\gt 0\), divide by \(a\):
\[
a=2
\]
Step 5: Final conclusion.
Therefore,
\[
\boxed{2}
\]