-1

I have a problem with an IP list for the MSG command in PowerShell. I have something like this:

msg (Get-Content -Path C:\Users\user\Desktop\ip_list.txt) (Get-Content -Path C:\Users\user\Desktop\text4.txt)

In ip_list.txt there is /server:10.0.1.119, but it doesnt seem to work, even if I put * /server:10.0.1.119 in it. The following does work, though:

msg * /server:10.0.1.119 (Get-Content -Path C:\Users\user\Desktop\text3.txt)

Any tips?

PS: AllowRemoteRPC is turned on.

Ansgar Wiechers
  • 193,178
  • 25
  • 254
  • 328
RHMojo
  • 3
  • 1

1 Answers1

0

Put just the IP addresses in the file ip_list.txt and run the command in a loop:

$msg = Get-Content -Path 'C:\Users\user\Desktop\text4.txt'
Get-Content -Path 'C:\Users\user\Desktop\ip_list.txt' | ForEach-Object {
    & msg * /server:$_ "$msg"
}
Ansgar Wiechers
  • 193,178
  • 25
  • 254
  • 328