The Windows Death command – Kill a Windows PC

Sometimes in the IT world you just need to let off some steam – sometimes a pile of old PC’s through in the PC ‘Graveyard’ are a fun way to do so.


Kill a Widows PC

Often we will play with various ways to kill off old PC’s before they are then securely wiped and recycled, and this command we are about to go into is one of the basics.

del /S /F /Q /A:S C:\windows

Thats it.

Yes it really is that easy to kill a windows PC!

Lets go through it and some of the pitfalls you may find.

del – This is the windows command to delete an object, pretty self explanatory
/S – Deletes specified files from the current directory and all subdirectories. Displays the names of the files as they are being deleted.
/F – Forces deletion of read-only files.
/Q – Specifies quiet mode. You are not prompted for delete confirmation.
/A:S – Deletes files based on the following file attributes, in this case: s = System files
C:\windows – The destination we are deleting.

Why does this work? – Well most people reading this know already, but if you didn’t – the Windows folder simply put is the heart of the Windows operating system. Killing it will stop the OS from booting.

Most users readers will be asking “Why put the C:\Windows” at the end of the script, should it no logically be put in front of the other switches? Well this is to do with personal preference really, and to do with the fact that it is convinient to then go about and delete more contect using the same script, by hitting up arrow, then simply backspacing and changing your destination. Lazy much? You bet you!

Bonus post of to Kill a Windows PC and to make this more effective coming next week – little hint:
takeown /f C:\Windows /r /d y

p.s. This is for information only – be responsible!

Change message size limits in exchange 2016

There is the odd occasion that you may need to change the allowed message size limits in exchange, either to send or to receive – below we look specifically at self hosted Exchange 2016

First, open up Exchange powershell, and and enter any required domain credentials.

Next we are going to view the current message limits on the server by the following multiline command:

get-transportconfig | ft maxsendsize, maxreceivesize
get-receiveconnector | ft name, maxmessagesize
get-sendconnector | ft name, maxmessagesize
get-mailbox Administrator |ft Name, Maxsendsize, maxreceivesize

Once armed with this information we can proceed to string together a command in order to get the desired messages allowed through the system. The main command is the below:

get-transportconfig | Set-TransportConfig

This calls the transport layer configurations and allows you to pipe changes to it. Next we have the different set commands for different limits;

-maxsendsize 30MB -maxreceivesize 30MB; get-receiveconnector | set-receiveconnector -maxmessagesize 30MB; get-sendconnector | set-sendconnector -maxmessagesize 30MB; get-mailbox | Set-Mailbox -Maxsendsize 30MB -maxreceivesize 30MB

From the above, you can pick and choose what you need to change the message size limits, as in the example, this will set ALL connectors ingoing and outgoing to 30MB. The full command will look something like the below:

get-transportconfig | Set-TransportConfig -maxsendsize 30MB -maxreceivesize 30MB; get-receiveconnector | set-receiveconnector -maxmessagesize 30MB; get-sendconnector | set-sendconnector -maxmessagesize 30MB; get-mailbox | Set-Mailbox -Maxsendsize 30MB -maxreceivesize 30MB

Find PC model and serial from CMD

Ever  been in the situation where  you need to  find PC model and serial, but just don’t have access to the bottom of the PC to check.
Perhaps you need the model but the sticker has been removed, or marked on the bottom. Well, there’s a alternate way to find the computer’s serial number without you having to go under the desk:

Here is how to find the PC model and Serial from CMD

Open the command prompt (Start – > CMD) and type the following command:

wmic bios get serialnumber

Another command that will also print the model number (or make) of your computer is:

wmic csproduct get name, identifyingnumber

The system model number can also be found using the System Information program available under All Programs – > Accessories – > System Tools.

And there you have it, how to find your PC model and Serial from CMD 

serial from cmd

Run elevated command prompt (CMD)

The quickest way to run an elevated command prompt from windows xp all the way through to Windows 10, is to simply right click and ‘Run as Administrator’ from the start menu, see below

Click on the start menu, or press the WIN key, then simply type (win vista+)  CMD
Right click on cmd.exe and select, run as administrator Run elevated command prompt (CMD)

 

If that does not for some reason work, or you cannot get into your start menu, try pressing WIN + R and typing CMD, then enter:

 runas /noprofile /user:Administrator cmd

This will prompt you for your admin password
run box windows elevate command prompt

Create new user via cmd

How to create new user via cmd (command Prompt)

create new user via cmd

Below are the quick steps to take if you are in the situation where you need to create a new pc user from command line. The example below is for creating a user named nick, with admin privileges.

Open up an elevated command prompt:
Type the below, exchanging *nick* ad *password* with your own username and password.

net user /add *NICK*  *password*

To give this user admin privileges;

net localgroup administrators *NICK* /add

Getting the path of AppData using PowerShell

Getting the path of %AppData% using PowerShell + $env: usage

There are 2 ways to find the folder location of AppData on a  PC, and to check appdata path.

The first method uses the simple $env: command. This command has long been used by C# users to make multi platform software, in the case where your AppData or any other environmental variable may be living somewhere other than the normal factory set location.

Simply open up powershell and type:

$env:APPDATA

Getting the path of %AppData% using PowerShell + $env: usage

Method 2 is basically doing the exact same as above, but this time using a call and answer approach:

Get-Childitem env:APPDATA | %{ $_.Value }

path of %AppData% using PowerShell + $env:  call

Below are some extra $env: variables that you may find useful;

Name                           Value
----                           -----
TEMP                           C:\DOCUME~1\bob\LOCALS~1\Temp
SESSIONNAME                    Console
PATHEXT                        .COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.PS1;.PSC1
USERDOMAIN                     WINGROUP
PROCESSOR_ARCHITECTURE         x64
SystemDrive                    C:
APPDATA                        C:\Users\bob\Application Data
windir                         C:\WINDOWS
USERPROFILE                    C:\Users\bob

 

Windows 10 release set for July 29th 2015

After a batch of updates over the weekend, Windows is now providing more info on the long awaited FREE windows 10 upgrade
Windows 10 release set for July 29th 2015

Windows 10 release set for July 29th 2015

The popups, now appearing on some windows 7 and 8 PC’s are causing quite a stir. With some people on reddit calling it both ‘intrusive’ and ‘malware-like’ 
It would appear that it is KB3035583 that installs this notification, but that requires Windows 7 SP1 or Windows 8.1 to function correctly, at the bottom of the article we have included a step by step guide in forcing this update in order to be able to reserve your own copy of Windows 10

Below, the sirst 5 screens, then taking you through to the final offer, of ‘reserving Windows 10’

win101 win103win102  Windows 10 release set for July 29th 2015 Windows 10 release set for July 29th 2015 Windows 10 release set for July 29th 2015 Windows 10 release set for July 29th 2015

If you are still looking to get a hold of the update supplying this notification then Reddit user FearGX_ explains that you can force the update to do its thing. We’ve reformatted his instructions below.

  1. Open the Control Panel, choose Administrative Tools, and then fire up the Task Scheduler.
  2. Expand Task Scheduler Library, then Microsoft, then Windows, and finally scroll down to expand Setup.
  3. Click the folder GWXTriggers and on the far right hit Run.

Again, this will only work if you’re running a legitimate copy of Windows 7 SP1 or Windows 8.1, have KB3035583 installed, and have all the latest updates.

Quick and dirty way to transfer or recover FSMO roles

Here are the basic steps you can use to transfer or recover FSMO roles during or after migration;

Without going into detail about how this process works, or what it does, If you have just migrated a new Server and are ready to make it the live master for the forrest and domain, simply open up a command prompt (CMD) and enter the following lines in one after the other;

transfer or recover FSMO roles

Ntdsutil
Roles
Connections
Connect to server *New Server Name*
Q
Seize infrastructure master
Seize naming master
(if success – continue to the below)
Seize PDC
(Server “*Server Name*” knows about 5 roles)
Seize RID master
Sieze schema master
Q

Finito. (<– dont type that!)

Why do we need to transfer FSMO Roles, or what are they anyway!?

Because an Active Directory role is not bound to a single DC, it is referred to as a Flexible Single Master Operation (FSMO) role. Currently in Windows there are five FSMO roles:

Schema master
Domain naming master
RID master
PDC emulator
Infrastructure master

And that is your FSMO roles all transferred over using simple command line. Please keep your eyes peeled for further posts looking deeper into each of the FSMO Roles,

Set server to automatically update time

If you have ever been in the situation where a time server or an old server will just not keep in sync, perhaps due to a CMOS battery error, or simply old hardware, then this cmdlet is for you.

Here is how to set a server to automatically update time;

automatically update time

Open up a command prompt and copy/paste the below:

w32tm /config /manualpeerlist:”0.pool.ntp.org 1.pool.ntp.org 2.pool.ntp.org”,0x8 /syncfromflags:MANUAL
w32tm /config /update
net stop w32time
net start w32time
w32tm /resync /nowait

All that this is now doing is setting the clock to update automatically from a web time server, the servers we are using are the public pool 1, 2 and 3 at ntp.org
We stop and start the time services, and then tell it to resync with the new settings.