Triviality of the adjoint and endomorphism bundles Let $P$ be be a principal bundle over a manifold $M$ with structure group $G$, where $G$ is a Lie group. Let $E = P\times_{\rho} \mathbb{R}^{k}$ be a vector bundle associated to $P$ through a faithful representation $\rho\colon G\to Gl(k,\mathbb{R})$. Let $\mathrm{Ad}(P) = P\times_{Ad}\mathfrak{g}$ denote the adjoint bundle associated to $P$, where $\mathfrak{g}$ denotes the Lie algebra of $G$. My question is the following:
If $\mathrm{Ad}(P)$ is topologically trivial, namely $\mathrm{Ad}(P)\simeq M\times \mathfrak{g}$, does it follow then that the endomorphism bundle $\mathrm{End}(E)\simeq E\otimes E^{\ast}$ of $E$ is also topologically trivial?
If I am not mistaken, this is clearly true if $G=Gl(k,\mathbb{R})$. I am interested in the case $G\subset Gl(k,\mathbb{R})$ and $G\neq Gl(k,\mathbb{R})$, with $G$ connected, compact and semi-simple.
Thanks.
 A: This was too long for a comment.  There are counterexamples where $G$ is a finite group.  The OP correctly notes that the endomorphism bundle of a rank $1$ bundle is trivial.  Nonetheless, there are plenty of examples in higher rank with nontrivial endomorphism bundle.  
For instance, let $G$ be the cyclic group of order $2$.  Begin with the real projective plane $\mathbf{RP}^2 = \mathbf{S}^2/G$ with its tautological $G$-bundle, $\mathbf{S}\to \mathbf{RP}^2$.  The standard inclusion $G\subset \textbf{GL}_1(\mathbb{R}) = \mathbb{R}^\times$ induces the tautological rank $1$ bundle $\gamma_2$.   Let $M$ be a product $X\times Y$ of two real projective planes $X\cong Y\cong \mathbf{RP}^2 = \mathbf{S}^2/G$.  The $G\times G$-bundle $$\widetilde{X}\times \widetilde{Y}\to X\times Y$$ and the inclusion $$G\times G\subset \mathbf{GL}_1(\mathbb{R})\times \mathbf{GL}_1(\mathbb{R}) \subset \mathbf{GL}_2(\mathbb{R})$$ induces a rank $2$ bundle $E$ that is simply $\text{pr}_X^*\gamma_2 \oplus \text{pr}_Y^*\gamma_2$. 
The endomorphism bundle is isomorphic to a rank $4$ bundle, $$\text{End}(E) \cong \mathbb{R} \oplus (\text{pr}_X^*\gamma_2\otimes \text{pr}_Y^*\gamma_2^\vee) \oplus (\text{pr}_X^*\gamma_2^\vee \otimes \text{pr}_Y^*\gamma_2) \oplus \mathbb{R}.$$  By the Whitney sum formula, the total Stiefel-Whitney class is $$(1)(1+\text{pr}_X^*a - \text{pr}_Y^*a)(1-\text{pr}_X^*a+\text{pr}_Y^*a)(1) =$$ $$ 1 - (\text{pr}_X^*a)^2 - (\text{pr}_Y^*a)^2 + 2\text{pr}_X^*a\cup \text{pr}_Y^*a.$$  Of course the last summand is zero since the coefficients are $\mathbb{Z}/2\mathbb{Z}$.  However, $a^2$ is nonzero in $H^2(\mathbb{RP}^2;\mathbb{Z}/2\mathbb{Z})$.  Using Künneth, the second Stiefel-Whitney class of $\text{End}(E)$ is nonzero.
A: There are counterexamples for $G$ connected abelian.
Let $X = \mathbb CP_2$,  $P$ be the complex line bundle $\mathcal O(1)$, viewed as a $G=SO(2)$-bundle. We take $\rho$ the standard two-dimensional representation of $SO(2)$. Of course the adjoint bundle is trivial in this case.
To show that $E \otimes E^*$ is nontrivial, we calculate its first Pontryagin class by tensoring with $\mathbb C$, where we can view it as $(\mathcal O(1) + \mathcal O(-1)) \otimes ( \mathcal O(-1) + \mathcal O(2) ) = \mathcal O(2) + \mathcal O + \mathcal O + \mathcal O(-2)$, which has second chern class $-4 H^2$, which is nontrivial, hence is a nontrivial complex vector bundle (and thus $E \otimes E^*$ is a nontrivial real vector bundle).
However, the statement might be possibly be true for $G$ connected, semisimple, and compact.

Let $Z$ be the center of $G$. Then the condition that $Ad(P)$ is trivial necessarily implies that the $G/Z$ bundle on $M$ induced by $P$ is pulled back from the obvious $G/Z$-bundle on $Gl_n(\mathfrak g)/ (G/Z)$, where $G/Z$ acts by right multiplication in the adjoint representation.
If $\rho$ is a representation on which $Z$ acts by scalars, then $E \otimes E^*$, as a representation of $G$, factors through $G/Z$, and hence is a pullback from $M$. 
So in this special case, it suffices to check whether the vector bundle $E \otimes E^*$ on $GL_n(\mathfrak g) / (G/Z)$ is nontrivial. However, I don't know how to do this.
