windows:powershell:updatehost
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| windows:powershell:updatehost [2014/02/21 00:05] – Newer version to gather host's BIOS and serial number data. haidong | windows:powershell:updatehost [2018/05/15 03:00] (current) – external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 6: | Line 6: | ||
| <code powershell updateHost.ps1> | <code powershell updateHost.ps1> | ||
| - | $HostList = Invoke-Sqlcmd -Query "exec Windows.Host_Select_HostID_HostName" | + | function updateHostSQL($h) { |
| - | $HostList | ForEach-Object | + | $HostName = $h.HostName |
| - | $HostName = $_.HostName | + | $HostID = $h.HostID |
| - | $HostID = $_.HostID | + | |
| try { | try { | ||
| Line 51: | Line 50: | ||
| $sql = "EXEC Windows.Host_Update $HostID, ' | $sql = "EXEC Windows.Host_Update $HostID, ' | ||
| + | return $sql | ||
| + | } | ||
| + | |||
| + | $HostList = Invoke-Sqlcmd -Query "exec Windows.Host_Select_HostID_HostName" | ||
| + | $HostList | ForEach-Object { | ||
| + | $sql = updateHostSQL($_) | ||
| Invoke-Sqlcmd -Query $sql -ServerInstance " | Invoke-Sqlcmd -Query $sql -ServerInstance " | ||
| } | } | ||
| </ | </ | ||
windows/powershell/updatehost.1392941146.txt.gz · Last modified: (external edit)
