Update from my last post back using your approach a bit differently. “correction pasted the wrong one”
$SSAS_services = @"
Server,Service,Startup Type,Task
$env:COMPUTERNAME,AxInstSV,Manual,stopped
"@ > 'D:\scripts\SSAS_services1.csv'
Import-CSV 'D:\Scripts\SSAS_services1.csv' |
ForEach-Object{
$svc = Get-Service $_.Service -ComputerName $_.Server | Select MachineName, Name, StartType, Status
Set-Service -ComputerName $_.Server -Service $_.Service -Status $_.Task -StartupType $_.'Startup Type' -PassThru |
Select MachineName, Name, StartType, Status,@{n='OldStartUp';e={$svc.StartType}},@{n='OldStatus';e={$svc.Status}}
}
MachineName : LC01
Name : AxInstSV
StartType : Manual
Status : Stopped
OldStartUp : Manual
OldStatus : Stopped
$SSAS_services = @"
Server,Service,Startup Type,Task
$env:COMPUTERNAME,AxInstSV,Disabled,stopped
"@ > 'D:\scripts\SSAS_services1.csv'
Import-CSV 'D:\Scripts\SSAS_services1.csv' |
ForEach-Object{
$svc = Get-Service $_.Service -ComputerName $_.Server | Select MachineName, Name, StartType, Status
Set-Service -ComputerName $_.Server -Service $_.Service -Status $_.Task -StartupType $_.'Startup Type' -PassThru |
Select MachineName, Name, StartType, Status,@{n='OldStartUp';e={$svc.StartType}},@{n='OldStatus';e={$svc.Status}}
}
MachineName : LC01
Name : AxInstSV
StartType : Disabled
Status : Stopped
OldStartUp : Manual
OldStatus : Stopped
$SSAS_services = @"
Server,Service,Startup Type,Task
$env:COMPUTERNAME,AxInstSV,Manual,stopped
"@ > 'D:\scripts\SSAS_services1.csv'
Import-CSV 'D:\Scripts\SSAS_services1.csv' |
ForEach-Object{
$svc = Get-Service $_.Service -ComputerName $_.Server | Select MachineName, Name, StartType, Status
Set-Service -ComputerName $_.Server -Service $_.Service -Status $_.Task -StartupType $_.'Startup Type' -PassThru |
Select MachineName, Name, StartType, Status,@{n='OldStartUp';e={$svc.StartType}},@{n='OldStatus';e={$svc.Status}}
}
MachineName : LC01
Name : AxInstSV
StartType : Manual
Status : Stopped
OldStartUp : Disabled
OldStatus : Stopped