0

What would be the best way to use powershell to script this scenario? We have a few machines that we need to rename, disable bitlocker for one reboot, reboot? Its not many and I want to improve my powershell chops. This is what I have so far:

$OldName = Read-Host 'What is the hostname of the machine you want to rename?'
$NewName = Read-Host 'What would you like to rename the machine to?'
Read-Host -Prompt "This will reboot the remote machine!  Press any key to continue or CTRL+C to quit" 
$cred = get-credential    
Rename-Computer -ComputerName "$OldName" -NewName "$NewName" -DomainCredential $cred -Restart

I wasn't sure if I could pipe to suspend bitlocker 1 reboot, or whats the best command for a remote machine. I know you can use a .csv list for a bunch of machines, but this is not that many.

pppery
  • 3,731
  • 22
  • 33
  • 46
808mrb
  • 1
  • 2

1 Answers1

0

manage-bde -protectors -disable c: is a batch command but works inside a powershell script as well. After one reboot, BL will re-enable automatically.

  • Thanks. How would you revise this line below to include that and run it on a remote machine though? Rename-Computer -ComputerName "$OldName" -NewName "$NewName" -DomainCredential $cred -Restart – 808mrb Mar 11 '22 at 16:58
  • Leave that line as is, but put it behind the line that disables bitlocker protection. – Bernd Schwanenmeister Mar 12 '22 at 08:23