changed URL because git.io is commonly blocked
This commit is contained in:
@@ -589,7 +589,7 @@ Function Import-MSP360Module {
|
||||
Write-Output "Installing MSP360 Powershell module"
|
||||
Set-ExecutionPolicy -ExecutionPolicy Unrestricted -Scope Process
|
||||
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
|
||||
Invoke-Expression (New-Object System.Net.WebClient).DownloadString('https://git.io/JUSAA')
|
||||
Invoke-Expression (New-Object System.Net.WebClient).DownloadString('https://raw.githubusercontent.com/msp360/MSP360-PSModule/master/private/Install-MSP360Module.ps1')
|
||||
Install-MSP360Module
|
||||
Import-Module -Name MSP360
|
||||
}
|
||||
@@ -726,18 +726,18 @@ Function New-LocalAccount {
|
||||
}
|
||||
If ( $(Get-LocalUser -Name $Username -ErrorAction SilentlyContinue) ) {
|
||||
Write-Output "Updating user: ${Username}"
|
||||
Try { Set-LocalUser -Name "${Username}" -Password $SecurePassword -FullName "${FullName}" -Description "${Description}" -AccountNeverExpires -PasswordNeverExpires }
|
||||
Catch { Write-Error $_.Exception.Message ; Exit }
|
||||
Try { Set-LocalUser -Name "${Username}" -Password $SecurePassword -FullName "${FullName}" -Description "${Description}" -AccountNeverExpires -PasswordNeverExpires | Out-Null }
|
||||
Catch { Write-Error "Could not update user`n"+$_.Exception.Message ; Exit }
|
||||
}
|
||||
Else {
|
||||
Write-Output "Creating user: ${Username}"
|
||||
Try { New-LocalUser -Name "${Username}" -Password $SecurePassword -FullName "${FullName}" -Description "${Description}" -AccountNeverExpires -PasswordNeverExpires }
|
||||
Catch { Write-Error $_.Exception.Message ; Exit }
|
||||
Try { New-LocalUser -Name "${Username}" -Password $SecurePassword -FullName "${FullName}" -Description "${Description}" -AccountNeverExpires -PasswordNeverExpires | Out-Null }
|
||||
Catch { Write-Error "Could not create user`n"+$_.Exception.Message ; Exit }
|
||||
}
|
||||
If ( (-not($(Get-LocalGroupMember -Group "Administrators" -Member $Username -ErrorAction SilentlyContinue))) -and $MakeAdmin ) {
|
||||
Write-Output "Adding ""${Username}"" to local Administrators group"
|
||||
Try { Add-LocalGroupMember -Name "Administrators" -Member $(Get-LocalUser -Name "${Username}") }
|
||||
Catch { Write-Error $_.Exception.Message ; Exit }
|
||||
Catch { Write-Error "Could not add user to Administrators group`n"+$_.Exception.Message ; Exit }
|
||||
}
|
||||
If ( $Hide ) {
|
||||
$RegPath = "HKLM:SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\SpecialAccounts\UserList"
|
||||
|
||||
Reference in New Issue
Block a user