Actually it worked! I tried a different command and it lists me root's files:
Output:
Thanks,
Rakesh
$session.ExecuteCommand("sudo -- sh -c 'whoami; cd ~ ;pwd; ls -lrt'");
Output:
root
/root
-rw-------. 1 root root 9813 Feb 26 2015 anaconda-ks.cfg
-rw-------. 1 root root 0 May 29 2017 newpasswd.ldif
Thanks,
Rakesh