parent
6351af0385
commit
86628469a2
@ -1,7 +1,21 @@
|
|||||||
|
# Install OpenSSH Server from Windows' optional features
|
||||||
|
|
||||||
Get-WindowsCapability -Online | Where-Object Name -like 'OpenSSH.Serv*' | Select-Object -ExpandProperty Name | %{Add-WindowsCapability -Online -Name $_}
|
Get-WindowsCapability -Online | Where-Object Name -like 'OpenSSH.Serv*' | Select-Object -ExpandProperty Name | %{Add-WindowsCapability -Online -Name $_}
|
||||||
Set-Service -Name sshd -StartupType 'Automatic'
|
Set-Service -Name sshd -StartupType 'Automatic'
|
||||||
|
|
||||||
|
# Delete cloudbase-init User
|
||||||
|
|
||||||
net user cloudbase-init /delete
|
net user cloudbase-init /delete
|
||||||
|
|
||||||
|
# Attribute service to local system
|
||||||
|
|
||||||
sc.exe config cloudbase-init obj= .\LocalSystem
|
sc.exe config cloudbase-init obj= .\LocalSystem
|
||||||
|
|
||||||
|
# Modify executon path of Service
|
||||||
|
|
||||||
$newtext = Get-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Services\cloudbase-init' -Name 'ImagePath' | Select-Object -ExpandProperty ImagePath | %{$_.replace(" cloudbase-init ", " NT-AUTHORITY\SYSTEM ")}
|
$newtext = Get-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Services\cloudbase-init' -Name 'ImagePath' | Select-Object -ExpandProperty ImagePath | %{$_.replace(" cloudbase-init ", " NT-AUTHORITY\SYSTEM ")}
|
||||||
Set-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Services\cloudbase-init' -Name 'ImagePath' -Value $newtext
|
Set-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Services\cloudbase-init' -Name 'ImagePath' -Value $newtext
|
||||||
|
|
||||||
|
# Remove a microsoft store language package that causes generelazing issues
|
||||||
|
|
||||||
Get-AppxPackage | Where-Object {$_.name -Like "*Language*"} | Remove-AppxPackage
|
Get-AppxPackage | Where-Object {$_.name -Like "*Language*"} | Remove-AppxPackage
|
@ -0,0 +1,17 @@
|
|||||||
|
# Replace in conf file Administrator username and group by the system's local language
|
||||||
|
|
||||||
|
$adminname = 'username=' + (Get-WmiObject win32_useraccount | Where-Object{$_.SID -like "S-1-5-*-500"}).Name
|
||||||
|
$admingroupname = 'groups=' + (Get-WmiObject win32_group | Where-Object{$_.SID -like "S-1-5-32-544"}).Name
|
||||||
|
|
||||||
|
if ((gwmi win32_operatingsystem | select osarchitecture).osarchitecture.Contains('64'))
|
||||||
|
{
|
||||||
|
$fileNames = Get-ChildItem "C:\Program Files\Cloudbase Solutions\Cloudbase-Init\conf" -Recurse | select -expand fullname
|
||||||
|
foreach ($filename in $filenames) { (Get-Content $fileName) -replace 'username=Administrator', $adminname | Set-Content $fileName }
|
||||||
|
foreach ($filename in $filenames) { (Get-Content $fileName) -replace 'groups=Administrators', $admingroupname | Set-Content $fileName }
|
||||||
|
}
|
||||||
|
elseif ((gwmi win32_operatingsystem | select osarchitecture).osarchitecture.Contains('32'))
|
||||||
|
{
|
||||||
|
$fileNames = Get-ChildItem "C:\Program Files (x86)\Cloudbase Solutions\Cloudbase-Init\conf" -Recurse | select -expand fullname
|
||||||
|
foreach ($filename in $filenames) { (Get-Content $fileName) -replace 'username=Administrator', $adminname | Set-Content $fileName }
|
||||||
|
foreach ($filename in $filenames) { (Get-Content $fileName) -replace 'groups=Administrators', $admingroupname | Set-Content $fileName }
|
||||||
|
}
|
Loading…
Reference in new issue