Author Posts

August 5, 2015 at 11:35 pm

I have been trying to use the below code and it doesn't seem to work , I get error stating "The RPC server is unavailable"

computer.csv contains 2 columns "OLDNAME" & " NEWNAME"

I'm trying to rename multiple computers however before the rename happens I want ipconfig and services info collected and saved in a text or html format.

Import-Csv -Path C:\Users\Wicky\Desktop\COMPUTERS.csv| ForEach-Object { Get-WMIObject Win32_Service -ComputerName $_.OLDNAME ; Get-WMIObject Win32_process -ComputerName $_.OLDNAME ;
Invoke-Command -ComputerName $_.OLDNAME {systeminfo} ;Get-ADOrganizationalUnit -ComputerName $_.OLDNAME ;
| Rename-Computer -DomainCredential $cred -ComputerName $_.OLDNAME -NewName $_.NEWNAME}|
Out-File rename.txt

could you please help editing my script to work.TIA

August 6, 2015 at 2:12 am

Hi Soma,
For Collecting Information and To do Invoke-command To Remote computers, Winrm Has To be enabled in remote computers.
enabling WinRM.

Enable-PSremoting -Force

The best way to get known about PS Remoting
https://www.penflip.com/powershellorg/secrets-of-powershell-remoting

Regards.,
kvprasoon

August 6, 2015 at 3:38 am

The error "The RPC server is unavailable" is because you will need to enable remoting.

August 7, 2015 at 9:44 pm

I'm able to restart the computer, take ps-session . remoting is enabled, still I get the error

August 9, 2015 at 7:10 am

Hi Soma,
You can try by enabling
Windows Management Instrumentation (WMI-In) in firewall inbound rule(Select proper profile-Domain, Private or All).
I was able to recreate the same by disabling it in remote machine.

Regards.,
kvprasoon