He has put get-credentials into the brackets so that it will prompt first to supply your credentials and then once the variable has your credentials value it will execute the entire command with your credentials later, this way the entire command will get executed without any errors especially related to credentials, hope this will help.
Awesome video, Mike! I'd like to add a little tip: If you have a firewall on, remember to open and restrict TCP port 5985 to only the few PCs used as 'jump stations.' Also, if you're outside the domain, you need to add the target as a trusted host on your local PC. Regards from Argentina 👋🫡
Hi Mike, Your video was great. I need help running the session in admin mode in those remote computers. I am already admin in those computers. Is it possible to do it?
Thank you that was the most Simplest and detailed one ,perfectly explained. I have one query though when I try using invoke command in my prod environment it gives me an error stating WINRM can not connect via Http/Https. I am not allowed to make any changes to existing setup can you tell me a work around for this?
Getting the following error. I have proper creds/perms, same domain, winRM configured properly. Any suggestions? PSRemotingTransportException + FullyQualifiedErrorId : ServerNotTrusted,PSSessionStateBroken
How do I set a computer name here (like you're setting up DC). There must be some way to set it up so that local machine will recognize the machine running behind DC. Got below error: Invoke-Command -ComputerName DC -ScriptBlock {get-date} [DC] Connecting to remote server DC failed with the following error message : WinRM cannot process the request. + CategoryInfo : OpenError: (DC:String) [], PSRemotingTransportException + FullyQualifiedErrorId : NetworkPathNotFound,PSSessionStateBroken
I liked the video, but i could not seem to get what's in the brackets after the scriptBlock to work.... $cn = $env:computername $un = $env:username $date = (Get-Date).ToString("yyyy-MM-dd") Invoke-Command -ComputerName Laptop -ScriptBlock {powercfg -batteryreport -output \\computer\d$\PowercfgFiles\${date}\${cn}_${un}_battery_report.html /duration 14} this works but puts the file on the local machine. i was trying to get the output to a different PC Invoke-Command -ComputerName Laptop -ScriptBlock {powercfg /Batteryreport}
you have run into what is called the "powershell double hop problem" your session cannot pass the creds you used to another session, that other session in this case is the SMB share connection. It is too much to explain here, but google 'powershell double hop problem' and it will put you on the right track. You need to re-authenticate the SMB connection
Very well explained. Kudos for explaining why you have to put get-credential into brackets.
Thank for taking the time to watch
He has put get-credentials into the brackets so that it will prompt first to supply your credentials and then once the variable has your credentials value it will execute the entire command with your credentials later, this way the entire command will get executed without any errors especially related to credentials, hope this will help.
I agree
Awesome video, Mike! I'd like to add a little tip: If you have a firewall on, remember to open and restrict TCP port 5985 to only the few PCs used as 'jump stations.' Also, if you're outside the domain, you need to add the target as a trusted host on your local PC.
Regards from Argentina 👋🫡
Fantastic tutorial, subbed!
thanks!
Very clear explanation. Shared this video with my teammates who are struggling to get started with PowerShell
Thank you. I will do more eventually, just been busy with other work
OH MAN!!!! Thank You, Thank You, Thank You!!! I was getting stuck and kept getting Access Denied. WoW This Really Helped me!! KUDOS
You are welcome!
best teacher EVER
@@brusslee1814 thank you very much, please feel free to subscribe and check out my other tutorials
wow thank you soo soo much!!!!! love from Pakistan
Outstanding explanation, mate. Thanks!
Very helpful! Broke it down for me and fully understood on the first go around!
No problem, check out some of my other content too. Every sub is more encouragement to make more
Cheers Mike. - keep them coming .
Thanks
Love your content. Keep up doing this🎉
Thank you. I’m trying to improve the editing each time
Hi Mike,
Your video was great. I need help running the session in admin mode in those remote computers. I am already admin in those computers. Is it possible to do it?
Explanation is too good.💯
Thank you. Remember to sub and watch my other content too
@@mwcloudYes i already did that.
@@Abhi_ThePrOblemSOlver Thank you, I appreciate it.
Has the advanced part to this video came out yet? Also Love the content!
not yet, I should proabably get around to that
Thanks Mike
Any time
Thank you that was the most Simplest and detailed one ,perfectly explained.
I have one query though when I try using invoke command in my prod environment it gives me an error stating WINRM can not connect via Http/Https. I am not allowed to make any changes to existing setup can you tell me a work around for this?
There isn’t one. If remote access is blocked in your environment by a higher admin. Then it’s blocked.
Could you please explain how I can use hash table for creating pssession
do you mean for storing credentials that you pass to a pssession?
Rockstar!
Getting the following error. I have proper creds/perms, same domain, winRM configured properly. Any suggestions?
PSRemotingTransportException
+ FullyQualifiedErrorId : ServerNotTrusted,PSSessionStateBroken
You need to set trusted hosts on the thing you are connecting from
Love it ❤
Thanky you!
How do I set a computer name here (like you're setting up DC). There must be some way to set it up so that local machine will recognize the machine running behind DC. Got below error:
Invoke-Command -ComputerName DC -ScriptBlock {get-date}
[DC] Connecting to remote server DC failed with the following error message : WinRM cannot process the request.
+ CategoryInfo : OpenError: (DC:String) [], PSRemotingTransportException
+ FullyQualifiedErrorId : NetworkPathNotFound,PSSessionStateBroken
Just use the name of the computer you are trying to connect to in your domain
MUITO OBRIGADO.
De nada
Is there any tutorial how to enable remote powershell in remote pc's?
Enable it remotely so you can then remote to them with powershell ?
Do
You have a course
Yes I do, i offer them privately and they are 5 days long, remotely or in person, you can contact me on my website should you want to enquire
@@mwcloud what’s your site
@@alainsabumits on the channel homepage
Yet, the SOC teams says it’s a security risk to enable windows remote management
this is light years ahead of a thick Indian accent (common on IT videos but so distracting)
Thanks
I liked the video, but i could not seem to get what's in the brackets after the scriptBlock to work....
$cn = $env:computername
$un = $env:username
$date = (Get-Date).ToString("yyyy-MM-dd")
Invoke-Command -ComputerName Laptop -ScriptBlock {powercfg -batteryreport -output \\computer\d$\PowercfgFiles\${date}\${cn}_${un}_battery_report.html /duration 14}
this works but puts the file on the local machine. i was trying to get the output to a different PC
Invoke-Command -ComputerName Laptop -ScriptBlock {powercfg /Batteryreport}
you have run into what is called the "powershell double hop problem" your session cannot pass the creds you used to another session, that other session in this case is the SMB share connection. It is too much to explain here, but google 'powershell double hop problem' and it will put you on the right track. You need to re-authenticate the SMB connection
@@mwcloud Thanks! i will look into that tomorrow.