The script below has been running on ps 5 till now. However i must now run it on 7 due to specific file scripts changes Can any one help me how to call this script PS 7.0
$Tenant = 'user'
$TenantPass = ConvertTo-SecureString 'pwd' -AsPlainText -Force
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
$credential = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList $Tenant, $TenantPass
$s = New-PSSession -ComputerName 'sv1' -Credential $credential
Invoke-Command -Session $s -Command {
& 'C:\file.ps1' -TenantUname $Tenant -newMail '<AD_email/>' -licensa '<CodigoExterno/>' -estado $<isActivar/>
}
Remove-PSSession $s
need to use
pwsh file.ps1
instead
powershell file.ps1