r/LearnPowerShell • • Feb 03 '21

Sending text with SMS gateways

1 Upvotes

Hi all,

I have written a script to send emails that works fine for emailing actual email addresses. But the moment I enter in a *10DigitPhonNumber*@vtext.com (spectrum/verizon number), the script runs, but no text is received. I tested with 11 digit numbers as well (US code 1) and it does the same thing. I have also tried it for tmobile numbers, and the same issue occurs.

Am I missing something? Any help would be appreciated.

my actual script is VERY barebones at this time. I declare my variables, and input my smpt server info when I am prompted. You will notice in the snipet below, I do not have -usessl, as this server does not use ssl.

Send-MailMessage -From $From -to $To -Subject $Subject -Body $Body -SmtpServer $SMTPServer -port $SMTPPort -Credential (get-credential)


r/LearnPowerShell • • Nov 08 '20

How to kill a hanging script automatically

1 Upvotes

New to powershell so asking here, I have a working script running on an EC2 instance that gets called whenever x happens. However there is a scenario where the script will not complete due to Start-Process waiting on another service to finish. How would you guys make it so that after say X minutes either kill the script or kill start-process? Google is not coming up with any results


r/LearnPowerShell • • Jul 24 '20

Call another script as an administrator

1 Upvotes

Hello,

I am currently attempting to use one script to install a program. Once the program installs I have to invoke another script as an administrator to copy a file from C:\Users\Public to C:\Programs x86.

Currently I have tried the line:

Start-Process powershell.exe -Verb RunAs -ArgumentList -File "C:\Users\Public\TmReg.ps1"

This is supposed to run the following command in a separate script:

copy-item -Path "C:\Users\Public\TmReg.ini" -Destination "C:\Program Files (x86)\TeamMate\Bin"

But this is not working and the file remains in the Public folder. Could someone ELI5 how to call another script from my current script?


r/LearnPowerShell • • Sep 19 '19

Trouble Renaming Domain Computer

1 Upvotes

PS C:\Windows\system32> Rename-Computer -ComputerName "**-******" -NewName "**-*******" -domaincredential domain\creds -force -restart

Rename-Computer : Computer **-***** cannot be resolved with the exception: One or more errors occurred..

At line:1 char:1

+ Rename-Computer -ComputerName "**-*****" -NewName "**-*****" -do ...

+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

+ CategoryInfo : InvalidArgument: (**-*****:String) [Rename-Computer], InvalidOperationException

+ FullyQualifiedErrorId : AddressResolutionException,Microsoft.PowerShell.Commands.RenameComputerCommand

Having a hard time finding information on this error throughout Google. All of the forums have pretty dated information. Any ideas on what the issue could be?