windows - Obtain PSCredential instance representing Local System built-in account -


running powershell version 5.0 on windows 10 build 10240. need obtain pscredential instance contains localsystem context. how can achieve this?

https://msdn.microsoft.com/en-us/library/windows/desktop/ms684190(v=vs.85).aspx

from documentation linked to:

this account does not have password. if specify localsystem account in call createservice or changeserviceconfig function, any password information provide ignored.

so, supply "any password information" in pscredential constructor:

$username = "nt authority\system" $password = "whatever feel like" | convertto-securestring -asplaintext -force $localsystemcreds = new-object -typename pscredential -argumentlist $username,$password 

Comments

Popular posts from this blog

Fail to load namespace Spring Security http://www.springframework.org/security/tags -

sql - MySQL query optimization using coalesce -

unity3d - Unity local avoidance in user created world -