With Windows Powershell, we are able to start a process as another user, with the command Start-Process Credential parameter. But in some conditions, you will get this error: The system cannot find the file specified. or The Directory name is invalid.
Start-Process Credential The file cannot find the file
The error occurs only if the parameter Credential is set. If not, Internet Explorer is starting. Let’s see how to resolve this issue.
Today I write a quick tips 🙂 Sometime, we need to know the external public IP address for a computer using Powershell. This can be done easily with a Web Service of ipify.org.
Powershell Public IP
(Invoke-WebRequest -uri "https://api.ipify.org/").Content
You can get more information about ipify.org here
With Windows Server 2016, Microsoft integrated the Microsoft Defender service into the operating system. This built-in antivirus is now running constantly but it does not have the Defender GUI installed by default. If you want to activate the graphical user interface on the server, this can be done using Windows Server Manager or Powershell cmdlet.
Windows Defender GUI
Let’s see how to activate or disable the Windows Defender Graphical interface:
During an Office 365 migration from an Exchange on-premises, it can be usefull to migrate contacts information. For some reasons, if you can not do a Active Directory synchronization, contacts information needs to be imported manually.
You can easily do that by running two scripts, one in your Exchange environnement which creates an csv file, and the other into the Office 365 Powershell.
Sometimes, it can be usefull to disable access to the Exchange server for a specific mailbox. For exemple, in order to forbid Outlook Web App (Outlook on the Web for Exchange 2016) but you do not want to disable the user account. Or you can prestage the mailbox and only allow access to a specific date/ time.
This can also be used during a migration to another mail system: when the user is migrated, you can disable all access to force the user on the new messaging system. And prevent any email sent by the old Exchange.
Exchange Disable access
Let’s see how to disable all access for a mailbox using ECP or Exchange Powershell:
Since Windows 8.1 and Windows Server 2012 R2, Microsoft released Powershell 4. A new cmdlet can be use to troubleshoot network connections issues : Test-NetConnection.
With Windows version older than Windows 8.1, you must install the Telnet client to test if a specific port is open on a remote host. Now, we have a built-in tool!
Test-NetConnection with google
Let’s see how to use this cmdlet:
During an Office 365 migration, it can be useful to set the regional configuration before the user logon the first time.
Specify the regional setting prevents the user to register the language and time zone again. Moreover, when you want to import PST files into the new office 365 Mailbox, default folders must have the same name. Otherwise you will get two folders for each default folder, like inbox, Sent, Drafts…
This modification can be done using the Office 365 Exchange cmdlet or we can use a powershell script. Let’s see how to do that.
During an Active Directory migration, I needed to do an inventory of the computers to migrate. Because some computers do not exist anymore but not removed from Active Directory. I created a Powershell script based on the Last Logon Timestamp property.
CSV file from the script
This powershell script creates a CSV file with the computer name, the last logon property and the operating system. Some domains were based on Windows Server 2003 or 2008, I could not use Active Directory commandlets, so I used the LDAP Search.
Microsoft released the Cumulative Update 11 for Exchange 2013 and Exchange 2016 CU1 in December 2015. With these new packages, they changed the behavior of Exchange Management Shell, (Exchange Powershell).
Prior to 2013 CU11 and 2016 CU1, when you start the EMS, it will connect by default to the local Exchange Server. But with CU11, Exchange Powershell will be proxy to the server where the user’s mailbox is located. It means that when you start the EMS console, it will probably try to connect to another server.
When all your servers are up to date, in some circonstances, you can get an error when launching the EMS: “No mapping for the Unicode character exists in the target”:
Mapping Unicode error
If you get this error, do not panic and stay calm :). You can find some posts where you need to rebuild the powershell virtual directory, but do not do this! Let’s see how to resolve this issue easily.
With Windows 8.1 and previous operating systems when you want to change the priority of a network card, you could change the Network Bindings using Advanced Settings in Network center.
This interface always exists in Windows 10 but this function was deprecated. Changes in “Connections” are no more applied. You can tell me that on a workstation, we don’t use this feature, and it is true. But I faced an issue with Windows 10, VMware Workstation and OpenVPN client.
When my LAB is up and running (Host-Only network), host connected to internet using OpenVPN Client, sometime the host loses access to internet. After troubleshooting, my host queries the DNS in my LAB and not the DNS of OpenVPN interface, and so the query failed because the DNS server does not have access to internet.
Let’s see how to solve this minor issue.