#region Parameters
[CmdletBinding(PositionalBinding=$True)]
param(
[Parameter(Mandatory=$True,Position=0)]
[System.String]$Location,
[Parameter(Mandatory=$True,Position=1)]
[System.String]$CwdID
)
#endregion
#region Define Variables
[System.String]$strUsername="";
[System.String]$strPassword="";
[System.String]$strFQDN="";
[System.String]$strSMBPath="\\"+$strFQDN;
[System.String]$strPowerShellFileName="C:\Windows\System32\WindowsPowerShell\v1.0\Powershell.exe -NoProfile -File C:\Gitlab-Runner\Enable-Remote-PS.ps1";
#endregion
#region Check if the Host(s) are Alive
[System.Boolean]$blnHostAlive=(Test-Connection-ComputerName$strFQDN-Count5-Delay1-Quiet);
#endregion
#region Copy the file to the remote host
if($blnHostAlive-eq[System.Boolean]::TrueString)
{
.\PsExec64.exe$strSMBPath-u$strUsername-p$strPassword-c-f$strPowerShellFileName-AcceptEula
}
#endregion
Discover more from Cloud Build Tools
Subscribe to get the latest posts sent to your email.
