This shows you the differences between two versions of the page.

Link to this comparison view

en:services:storage_services:backup:tsm:admin:powershell [2019/02/19 09:50] (current)
bnachtw created
Line 1: Line 1:
 +====== A collection of PS commands for TSM / ISP ======
 +===== getting Hardware information =====
 +  * get WWN of installed FC-HBA <​code>​Get-WmiObject -class MSFC_FCAdapterHBAAttributes -namespace “root\WMI” | ForEach-Object {(($_.NodeWWN) | ForEach-Object {“{0:​x}” -f $_}) -join “:​”}</​code>​e.g.:​{{ :​en:​services:​storage_services:​backup:​admin:​ps-get-wwn.png |}}
 +===== 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.