Table of Contents
A collection of PS commands for TSM / ISP
getting Hardware information
chaning credentials of windows services
Ordinarily the sc.exe
command can be used to change the credentials of a windows service. unfortunately the powershell does not easily support the use of sc.exe
with a pipeline after the Get-Service
commandlet … and the powershell itself has no commandlet that works like the sc.exe
command
so the solution is a combination of both: getting all services to be changed and put them into an array and then run a for loop on this array:
$id=<[DOMAIN\]USER>; $pw=<Password for user $ID>; $svs=(Get-Service | Where-Object {$_.DisplayName -like "TSM Client SCHEDULER*" } | %{$_.Name}); foreach ($sv in $svs) { sc.exe config $sv obj= "$id" password= "$pw"; Restart-Service -Name "$sv"; echo $sv; }
consider: the | %{$_.Name}
at the end of the pipe is necessary to get just the name, but no tabular output.