Configure SMTP using Powershell (IP and Port) - windows

I am trying to configure SMTP since I set it up on servers all the time and most of the settings are similar, I have some of it down but cant get everything changed the way I want even after going through all the settings. I can get things like maximum message size, smart host, FQDN but cant change the IP, port, or enable logging. I could definitely just be missing settings but I feel like I've been through them all.
I got most of it working like changing the smart host using:
$smtpserversetting = get-wmiobject -namespace root\MicrosoftIISv2 -computername localhost -Query "Select * from IIsSmtpServerSetting"
$smtpserversetting.MaxMessageSize="10485760"
$smtpserversetting.SmartHost="smtp.office365.com"
$smtpserversetting.FullyQualifiedDomainName="myFQDN.com"
$smtpserversetting.put()
That's not everything I'm changing but that's the method I'm using. However the thing I cant get is this IIS 6 IP and logging
I cant find the settings anywhere for this tab at all. I just want to change the IP to the server I'm on, change the port to 587 and set up logging. To be clear I dont need to send an SMTP email just want to configure then I can test outside powershell. Any help would be appreciated.

Related

Anyone used Unified Write Filter (uwfmgr) and netsh together? I'm seeing some off things after running netsh and then rebooting

I've have a Win10IoT Enterprise image I've built.
It is running with Unified Write Filter enabled on the system (C:) volume.
I have the following registry exclusions added to the system disk (the only protected volume) to allow changing IP addresses via netsh to persist and be saved through the filter.
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Class{4d36e972-e325-11ce-bfc1-08002be10318}
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\Interfaces
When I boot the machine with the uwf filter ON I do the following actions....
Run netsh to set a static IP, Subnet, and gateway
Verify the commanbd worked with ipconfig
Check the NIC card GUI in Windows and also verify it looks good there.
Everything at this point looks great. I now reboot the machine (uwf filter still on).
When the machine reboots I check the IP address again via ipconfig and the NIC GUI to verify they are still good.
This is when things get odd. The ipconfig looks fine, but in the GUI window the IP is listed as the last static IP address I set with the uwf filter OFF (192.168.0.20 in this example). If I click the advanced settings there are two address listed under the IP Addresses, my expected 192.168.0.50 address as well as the old 192.168.0.20.
Some more info, the machine will respond to pings to 192.168.0.50 but will not respond to 192.168.0.20. I'm guessing there is another registry setting somewhere that is getting reverted causing the GUI to not update correctly. Anyone have any ideas?
Thanks!
Post reboot images....
I had the same problem.
But when I add HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Nsi to my exclusion list, it works

Windows Events Forwarding: Error Code 2150859195

I have been struggling to find a solution for the following errors when I configure Forwarding Windows Events to a collector using source initiated http (I followed most blogs on configuration). The error is:
ErrorCode 2150859195
ErrorMessage The WinRM client cannot process the request. Default authentication may be used with an IP address under the following conditions: the transport is HTTPS or the destination is in the TrustedHosts list, and explicit credentials are provided. Use winrm.cmd to configure TrustedHosts. Note that computers in the TrustedHosts list might not be authenticated. For more information on how to set TrustedHosts run the following command: winrm help config.
So far, I have tried to add the collector IP to the client's TrustedHosts and vice versa; add NetworkService account to the Event Log Readers group.
I felt lucky to figure it out and wanted to share here to help others. At least, after I made the following change on the source computers, I worked well now.
use FQDN not the IP address of the collector. I do not know why
enable WinRM listeners policy, set both IPv4 and IPv6 value to *

How to specify DNS server for a VPN Connection by PowerShell?

I am fairly new to PowerShell so please forgive me if the question looks stupid.
I am trying to configure VPN Connections using PowerShell. With the help of PowerShell ISE, I have no trouble creating a VPN connection and configuring VPN specifics. However I also need to set the DNS server of this VPN to 8.8.8.8, a task of which none of the cmdlets in VpnClient module is capable. I figured that all the settings in "Networking" tab is not accessed by VpnClient module so I tried DnsClient, NetAdapter,NetTCPIP and NetConnection, but the commands in these module all need a parameter called either Name or InterfaceAlias.
I successfully changed the DNS Configuration of my Ethernet Adapter by Set-DnsClientServerAddress -InterfaceAlias Ethernet -ServerAddresses 8.8.8.8,8.8.4.4. However, if I give my vpn name to -InterfaceAlias option then PowerShell gives out an error, saying it cannot find such InterfaceAlias.
I listed all interfaces on my Windows but there's no sign of any vpn connection.
All helps are appreciated, thank you!
Thanks to #DavidBrabant, it seems that it is a bug that Microsoft has not fixed since Windows Vista. I then followed one of the solutions on that kb article: using .Net Class.
The result is still the same as before: no sign of any vpn connection. My input and output look like this:
PS C:\WINDOWS\system32> [System.Net.NetworkInformation.NetworkInterface]::GetAllNetworkInterfaces().NetworkInterfaceType
Wireless80211
Wireless80211
Ethernet
Loopback
Tunnel
Tunnel
I haven't tried the second resolution which is "Use the GetAdaptersAddresses API" because I don't know how. Anyone knows? Or did I miss something from the .Net framework?
Since I can't comment and/or +1 anything because of switching to new account. I want to mention that above Antonio's solution works just fine. You have to use common sense and understand things a little more. I will elaborate on Antonio's message. Understand that the people who are answering you are either coding professionals or IT professionals. So they answer in assumption you are one as well. Please do not -1 anything if you haven't tried it and don't understand it. ASK they will help you and explain more if needed.
Set-DnsClientServerAddress -InterfaceAlias Corporate -ServerAddresses 8.8.8.8
Let's break this down. So what is this saying?
Set-DnsClientServerAddress
This is assuming you're already connected to the VPN. as Antonio actually mentioned.
you have to connect to the VPN first
Ok now that we have the understanding that this command through powershell assumes we're connected to the VPN (Only 1 by the way not more than 1).
Let's tackle the rest of the command.
-InterfaceAlias Corporate
Ok so those who code undestand that -InterfaceAlias is a Parameter to the Set-DnsClientServerAddress command. Then following that parameter you have attributes. Now that attribute can either be TEXT (aka a String) or a boolean value (aka $True or $False). So in this case he is saying that his vpn is called Corporate. Now with most Windows stuff. Windows will accept strings un quoted if it's all 1 word. However if your VPN Name has a space in it then it will not accept it. you would have to encapsulate your string with quotes. for example.
-InterfaceAlias "My VPN"
So in this case you need to know what your VPN Name is. If you don't know what your VPN Name is, please go to the following location.
Control Panel -> Netwok and Sharing Center -> Change Adapter Settings (left hand side) -> net find your VPN Adapter.
Alright so the last bit.
-ServerAddresses 8.8.8.8
So this ServerAddresses property is already strictly data typed to an IP address or multiple IP addreseses. So in this case you would need to know the DNS Server you wish to request DNS resolution from and replace it (8.8.8.8 = Google outside DNS server). So for example
-ServerAddresses 10.1.10.254
Now this will set the DNS server to be 10.1.10.254 for this VPN Adapter.
Kill the VPN and then start it up again. Open a command prompt and type the following
ipconfig/all
This will show you all your current adapters. For your VPN adapter it should show your updated DNS. If you still can't resolve DNS names it possibly has to do with your Type of DNS server and you will have to probably specify a DNS suffix manually as well. See the following article for more details.
https://superuser.com/questions/966832/windows-10-dns-resolution-via-vpn-connection-not-working
Hope this helped. Sometimes us Senior IT guys just don't have the time to type it all out for business owners and/or new to the trade IT personnel.
-Grafix
To be able to change the interface DNS of a windows VPN you have to connect to the VPN first then use the PS command
Set-DnsClientServerAddress -InterfaceAlias Corporate -ServerAddresses 8.8.8.8
I did it and after that I was able to join the windows 10 to the domain; also first you have to create the VPN using the PS command
Add-VpnConnection -Name "My VPN" -ServerAddress "x.x.x.x" -TunnelType Pptp -EncryptionLevel Required -AuthenticationMethod MSChapv2 -AllUserConnection -RememberCredential -PassThru

Can't access XAMPP from other computers

I have installed xampp on my windows7(64bit). I can view my php website from my own computer but others within the same network can't open no matter they tried my own IP 192.168.x.xx/web folder or 127.0.0.1/web folder.
I did the same thing before in the 32bit win7 and it worked fine. I wonder how I can get it work?
I am pretty new to php and xampp so please give more detail. Really appreciate it!
If you are using windows than all you have to do is to go to Allow an app through Windows Firewall.click on Allow another app select Apache and mark public and private both .Again Allow another app this time select xampp and mark both public and private and is done click apply and exit .
Open cmd by pressing windows button+r write cmd than in cmd write ipconfig find out your ip . than open up your browser write down your ip http://192.168.1.x and you will be on the xampp startup page.if you want to access your local site simply put / infront of your ip e.g http://192.168.1.x/yousite.
Now you are able to access your website in private network computers .
Try running this command and verify that your web server port is listening on all interfaces (0.0.0.0):
netstat -an | find "LISTEN"
It is really common for Tomcat to not listen on 0.0.0.0 until you specifically configure it to do so.
Other than that, verify the port is not being blocked by something.
127.0.0.1 definitely wont work as that is the ip address of the local machine.
Are you perhaps missing a port number in your url, so from another computer try 192.168.x.x:80/index.html or similar
May be your firewall configuration is on, change it, your issue will resolve. I too have the same issue and resolved it through this way.
Change Your Firewall Setting. It would be on So Please off window firewall Setting. I hope so it will be work.

FTP using filezilla

Its been so long since i've needed to ftp something I seem to have forgotten how to do it.
(server address)I have got my ftp address
(password)I have got my password
(port)I have assumed the port is 20 or 21
I am using Filezilla and the above are the only information it requests.
I had connected it to localhost without any problems apart from it not showing the files that are stored in my htdocs folder (I had a look to see if i needed to direct to the folder but couldn't find anything to say that it was necessary) the port number for that was 14147. When I try to connect to a remote host I keep receiving errors saying maybe the port is incorrect or "Connected, waiting for authentication", I cannot leave the port option blank, I have tried 20, 21, 25, 80, 8080, 14147 and a couple of random ones after getting frustrated.
I have gone onto my provider and tried to find the port but cant seem to find the port they use for anything other than the emails, that was 25 and that is when i get the Connected, waiting for authentication message.
In short can someone please direct me to an idiots guide to FTP'ing, I know it should be quite straight-forward, but i'm really struggling. I have looked at a few tutorials but as it is such a straight forward job none seem to address my issue.
Please help (I assume what im trying to ftp doesnt make a difference?)
Little confusing to understand but if you need help setting up an ftp servers, heres how:
download and install Filezilla server(assuming this is done)
when it asks for what server leave it at default(host is 127.0.0.1
and port 14147)
set up a group. for this go to edit->groups and
hit add and name it.
now go to shared folders and select the
folder(s) you want this group to access along with what permissions
they need. Hit ok.
now set up a user in your group. Go to
edit->users
Click add, name the account(this will be your
username) and set the group
ensure the box labeled enable account
is selected and that you have a password set up.
hit ok to save
changes. Now try to connect through localhost using an FTP client.
if it works then continue on. If it does not work ensure that a
firewall is not blocking the server
set up port forwarding for
port 21(every router is different so try googling how to do this).
test by using your external ip address. Don't know it? try
whatismyip.com
That should be all you need to do for your new FTP server

Resources