• /r/powershell
  • Passing a parameter in New-Alias

    Hi, I use PS Remoting a lot with my T2 account and would like to have Remote <hostname> do Enter-PSSession <hostname> -Credential ADCourtJestersT2 Is that possible? I tried using a function like: Function Enter-PSSession {Enter-PSSession -Credential ADCourtJestersT2} New-Alias remote Enter-PSSession but it just hangs when I do that. submitted by /u/courtjesters [link] [comments]

  • /r/powershell
  • The Hacker Playbook

    Hello all, I have just recently purchased the book and the first powershell command it gives us already got me stuck, somehow it doesn’t work, maybe outdated? I googled and found other commands that says it does the same thing, but does it really? because the author says that if anything changes it will get […]

  • /r/powershell
  • Needing help with script, keep getting “handle is invalid”

    I’m trying to disable the disk defrag task on a list of servers that I’ve compiled and placed in a text file. I’m then running the following script to disable the task but keep getting the error “the handle is invalid”, any suggestions? Set-Alias -Name PSExec -Value C:WindowsSystem32PSExec.exe $servers = Get-content C:ScriptslogsDefragList.txt foreach ($server in […]