This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$csv = Import-csv C:\Input.csv | |
$csv.MachineName | ForEach-Object {if(Test-Connection -Count 1 -Quiet $_){ $_ | Select @{N='MACHINENAME';E={Get-WmiObject -cn $_ Win32_OperatingSystem | Select -expand PsC*}},@{N='OSVERSION';E={Get-WmiObject -cn $_ Win32_OperatingSystem | Select -ExpandProperty Cap*}}}} | Export-Csv C:\Output.csv -nti |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ip=((gwmi Win32_NetworkAdapterConfiguration | ? { $_.IPAddress -ne $null }).ipaddress | select -First 1) | |
$ipAddressName = $ip.Replace(".","-") | |
If ($env:COMPUTERNAME -eq $ipAddressName) { | |
Write-Host "$ipAddressName No need to change" | |
} | |
Else { | |
Rename-Computer -NewName $ipAddressName -Restart | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
GWMI WIN32_OPERATINGSYSTEM -CN DC1,DSC1 | SELECT P*ME,S*J*N,V*,@{N=’BIOSSERIAL';E={GWMI -CN $_.PSCOMPUTERNAME WIN32_BIOS| SELECT -EXPAND S*R}} |
NewerOlder