Powershell - Using XML as config file

It is extremely easy to use xml as a config file:

To load values from XML,
For example:

Settings.xml:

<?xml version="1.0" encoding="UTF-8"?>
<DefaultValues>
 <Version>22.09.2017.2</Version>
</DefaultValues>


[xml]$Settings = Get-Content "pathto\Settings.xml"
$version = $Settings.DefaultValues.Version

 

Inject Drivers to Boot.wim

There are sometimes after PE Boot, and you need the right drivers for nic or whatever.
This is how you inject the required drivers to a boot.wim

DISM TO MOUNT AN IMAGE:
Dism /mount-wim /wimfile:C:\new\Win10Boot.wim /index:2 /mountdir:C:\tmp

INJECT DRIVER
dism /image:"C:\tmp" /add-driver /driver:"C:\drv\folder" /Recurse

COMMIT AND DISMOUNT
Dism /unmount-wim /mountdir:C:\tmp /commit

Useful Commands
Dism /Image:C:\tmp /get-drivers
Dism /get-wiminfo /wimfile:C:\new\Win10Boot.wim

* Make sure you inject drivers to the right index.

Replace DC with new hardware and keeping old servername/ip

This was the project that completed during this break.
The old infrastucture has 1 PDC (2008R2, standalone) and 1 BDC (2012R2, hyperv)
The aim was to replace the PDC with a new hardware due to its age (about 6 years old and out of warranty)
At the end of the project, We have 1 new PDC (2012R2, standalone) and 1 BDC (2012R2, hyperv)

The whole process turned out pretty straightforward and completed smoothly.

As a summary, here are the main steps taken:

1. Install 2012R2 on the new server, Windows updates
2. Add Roles, ADDS 
3. Promote the new server to a Domain Controller
4. Wait for it to replicated across all DCs
5. Transfer FSMO from old server to new server
6. Robocopy, files and folders from old server to new server keeping the same permissions and file structures (because we had file shared from the old server) 
7. Install Files and Storage Services on new server
8. Tested Files/Shares and permissions and are working as expected
9. change old server's name to something else using "netdom computername"
10. change old server's ip to something else
11. change new server's name to old server's name
12. change new server's ip to old server's ip
13. Configure DNS Upstream Forwarder on the new server 
14. Install/Configure DHCP on new server
15. run dcpromo on the old server to demote from the AD, and decommissioned.

Here are some websites that I reference to complete this project:
1. http://jackstromberg.com/2013/10/migrating-domain-controllers-from-server-2008-r2-to-server-2012-r2/
2. https://www.experts-exchange.com/questions/27872748/Replacing-a-Primary-Domain-Controller-with-new-hardware.html
3. https://www.experts-exchange.com/questions/28233238/robocopy-copy-files-from-one-server-to-another.html
4. http://support.microsoft.com/?kbid=125996 (Import/Export file shares)
5. https://technet.microsoft.com/en-us/library/cc835082(v=ws.11).aspx (Rename Domain Controller)

Notes:
Useful commands: (used in this project)
netdom query fsmo, nltest, dcdiag, ntdsutil, etc
robocopy.exe W:\ D:\ *.* /e /copyall /r:3 /w:2 /nfl /ndl /mt /tee /np /log:"C:\robocopy_20170119.log"
Steps to change Domain Controller name:
1. netdom computername /add (add althernative name)
2. netdom computername /makeprimary (restart server after this)
3. netdom computername /remove (remove old name)

How to reset/add user/password in Windows 10 without login

What happen when you forgot your password to log into Windows 10 and there is no other account that you could log into?

Turn out Windows 10 has a hidden feature which can be very handy in this situation!

Boot the computer with a Windows 10 Installation CD or Win10PE
Once in the command prompt:

move C:\Windows\System32\utilman.exe C:\Windows\System32\utilman.exe.bat
copy C:\Windows\System32\cmd.exe C:\Windows\System32\utilman.exe

Reboot the computer normally.
When you get to the login screen, normally under bottom right corner, there is this Ease Of Access button ease-of-access-icon1. Which is now replaced with CMD.

Open the command prompt:

net user <username> <password> /add
net localgroup administrators <username> /add

That's it. You could now login with that newly created administrator account and reset your forgotten password for that accout!

Reference from here

 

NetXMS on Ubuntu Server 16.04.1

Install Ubuntu Server as usual
Don't forget to install Openssh Server during the process

After it finished, if you want to install lightweight desktop: (this is optional, because most of the works are done in terminal via ssh)
For ex: (lxde)

#sudo apt-get install --no-install-recommends lubuntu-desktop

Now to install NetXMS (current: 2.0.6)

#apt-get update
#apt-get install mysql-server
#apt-get install tomcat7
#apt-get install libmysqlclient-dev
#apt-get install libssl-dev
#apt-get install g++
#apt-get install c++

Create a database:

#sudo mysql -u root
mysql> CREATE DATABASE netxms;
mysql> GRANT ALL ON netxms.* TO netxms@localhost IDENTIFIED BY 'password';
mysql> quit

Download the NetXMS server package:

#wget http://www.netxms.org/download/netxms-2.0.6.tar.gz
#tar -xvf  netxms-2.0.6.tar.gz

Configure the package:

#cd netxms.x.x.x
#sudo sh ./configure --with-server --with-mysql --with-agent (it will show some results)
#sudo make
#sudo make install
#sudo cp contrib/netxmsd.conf-dist /etc/netxmsd.conf
#sudo cp contrib/nxagentd.conf-dist /etc/nxagentd.conf
#sudo nano /etc/netxmsd.conf

sample output:

DBDriver = mysql.ddr
DBServer = localhost
DBName = netxms
DBLogin = netxms
DBPassword = password
LogFile = /var/log/netxmsd
LogFailedSQLQueries = yes
#sudo nano /etc/nxagentd.conf
MasterServers = 127.0.0.1, 192.168.1.1

Initiaze agent and server services:

#sudo cat /etc/ld.so.conf.d/libc.conf (check it contain /usr/local/lib, if not add it)
#sudo ldconfig
#sudo ldconfig -p|grep libnetxms (it shows some output)
#/usr/local/bin/nxdbmgr init /usr/local/share/netxms/sql/dbinit_mysql.sql
#/usr/local/bin/nxagentd -d
#/usr/local/bin/netxmsd -d

Download the web based management:

#wget http://www.netxms.org/download/webui/nxmc-2.0.6.war
#sudo rename nxmc-2.0.6.war nxmc.war
#sudo cp nxmc.war /var/lib/tomcat7/webapps/
#sudo netxmsd  (this is to start netXMS server properly, otherwise you will get connection refused when you login)

Open browser:
http://ip_address:8080/nxmc/nxmc
(default username: admin, password: netxms)

NetXMS website: http://www.netxms.org/
My installation was based on this reference, though there was some hiccups along the way!