@@ -1,8 +1,9 @@
param(
$Script,
- $ComputerName
+ $ComputerName,
+ $ArgumentList = @()
)
$source = Get-Command $Script | Select-Object -ExpandProperty ScriptBlock
-Invoke-Command -ScriptBlock $source -ComputerName $ComputerName
+Invoke-Command -ScriptBlock $source -ComputerName $ComputerName -ArgumentList $ArgumentList
@@ -17,6 +17,10 @@ if ($null -eq $Username){
$Username = Read-Host 'Enter username for auto-logon (f.e. contoso\user1)'
}
+if ("" -eq $Username) {
+ throw "Username is Empty!"
+}
+
if ($null -eq $Pass){
$Pass = Read-Host "Enter password for $Username"