Skip to content

Commit

Permalink
Fixed WindowsPowerShell Profile Path and added IMPORTANT NOTE Line 42-46
Browse files Browse the repository at this point in the history
  • Loading branch information
pldmgg authored Nov 29, 2023
1 parent 5a1a6ad commit b06961e
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion MyScripts/Bootstrap-RemoteHostViaSSH.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,11 @@ $ScriptsBaseUri = "https://raw.githubusercontent.com/pldmgg/misc-powershell/mast
}
}

# IMPORTANT NOTE: If YOU are not the one to install SSH/SSHD on the remote Windows Machine using the above...
# Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://raw.githubusercontent.com/pldmgg/misc-powershell/master/MyScripts/Install-SSHD.ps1'))
# ...make sure you set powershell.exe as the default shell for SSHD on the remote host via:
# $PowerShellBinPath = $(Get-Command "powershell.exe").Source; Set-ItemProperty -Path HKLM:\SOFTWARE\OpenSSH -Name DefaultShell -Value $PowerShellBinPath -ErrorAction Stop

$ScriptsDir = "C:\Scripts"
Import-Module "$ScriptsDir\powershell\BootstrapRemoteHost.psm1"
$NewComputerName = "win11services1"
Expand Down Expand Up @@ -109,7 +114,7 @@ $null = Invoke-WebRequest -Uri "https://raw.githubusercontent.com/pldmgg/misc-po

# Set profile.ps1 for Windows PowerShell
$PSProfilePath = "C:\Windows\System32\WindowsPowerShell\v1.0\profile.ps1"
$PSProfilePath1 = "C:\Users\$RemoteUserName\Documents\PowerShell\Microsoft.PowerShell_profile.ps1"
$PSProfilePath1 = "C:\Users\$RemoteUserName\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1"
$SCPRemoteLocationStringPSProfile = $RemoteUserName + '@' + $RemoteIPAddress + ':' + $PSProfilePath
$SCPRemoteLocationStringPSProfile1 = $RemoteUserName + '@' + $RemoteIPAddress + ':' + $PSProfilePath1
scp.exe -i $SSHPrivateKeyPath $tempFileForProfile $SCPRemoteLocationStringPSProfile
Expand Down

0 comments on commit b06961e

Please sign in to comment.