There are 2 users currently logged on a server via remote desktop protocol (RDP) and want to asked them to log out while I perform maintenance. There is a utility in Windows called MSG . It is a utility to send a message to a user that’s currently logged onto a system.
To send a message to a remote server, from the terminal:
$> msg * /server:SERVER1 /time:30 /v "Could either USER1 or USER4 logout until 1PM? I need access to prepare for the migration next week"
* : I’m sending the message to all sessions
/server: The name of the server I’m sending the message to.
/time:30 : I’m giving the users 30 seconds to acknowledge the message. If no time is listed, the message will stay on the screen until the users click OK.
I wrote a script to get the mac address off of several servers, so it required my username and password. I don’t like to put my password in a script, but the credentials pop-up box for me to enter my password got a bit cumbersome. I decided to put it an a separate file for 2 reasons, 1) so my password is not saved in a script (I delete from the file once I’m done) and 2) making scripts modular is what it’s all about.
I’m building a new 2012R2 server that will replace an existing 2008R2 application server. I want to see what roles I need to install on the new server, so I run the Get-WindowsFeature cmdlet in PowerShell to give me what I need.
I have saved the output of Get-WindowsFeature to .csv on 2 servers, a new server and the old, production server.
The -ReferenceObject and -DifferenceObject options weren’t needed in this example. I got the same output with and without it.
So, on both new and old server, File Server, Remote Server Administration tools, are installed.
The new server has its own default roles and features installed and the old server has the list of roles that must be installed onto the new server, if applicable. The old server is 2008 and the new server is 2012 R2. Many features are now either default (PowerShell) or updated (.NET Framework 4.5). This list isn’t one to one, but it gives me an idea what needs to be installed in order to migrate a service from one OS to another. T
There are many useful applications for diff’ing files. What are some of your most common uses?
You can assign the files to variables and use the split() function to get rid everything up to a delimiter and output the ‘newly cleaned’ file to a new file.
The -ShowWindow parameter will give you a popup window with the help topic you’re researching. You can search words and phrases within the help topic. The found term is highlighted for easy reading and you can move between terms using the previous and next buttons. The window can be resized and you can increase or decrease the text with the slider at the bottom of the window. The description is a bit shorter for some cmdlets, but there are even some command examples displayed in the help window to get you going without coming out of your prompt.
Gone are the days of opening a second Powershell window to reference the help while crafting command line syntax. -ShowWindow is a great too in the Powershell arsenal.
~Note~ This works differently in PS 4.0 and 5.0. and within different builds of Windows 10.
Some contents are missing or out of order. It appears it is a known issue.
Your mileage may vary.
Don’t forget HelpCmdletname-online It launches help in the browser. Keeping you in your PS window without taking you away from your prompt.
Checking the hash of a file you’ve downloaded from the internet is very good practice. It’s a way to ensure the file you’re downloading hasn’t been tampered with, according to the hash provided on the site you’re downloading from.
Since Powershell 4.0, Get-FileHash has been a way to check the hash signature of a file.