<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Technology | TekCookie</title>
	<atom:link href="https://tekcookie.com/category/technology/feed/" rel="self" type="application/rss+xml" />
	<link>https://tekcookie.com</link>
	<description>Everything about IT</description>
	<lastBuildDate>Thu, 25 Nov 2021 07:22:53 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	

<image>
	<url>https://i0.wp.com/tekcookie.com/wp-content/uploads/2021/06/cropped-TekCookie-211.png?fit=32%2C17&#038;ssl=1</url>
	<title>Technology | TekCookie</title>
	<link>https://tekcookie.com</link>
	<width>32</width>
	<height>32</height>
</image> 
<site xmlns="com-wordpress:feed-additions:1">174510684</site>	<item>
		<title>WordPress website using Docker</title>
		<link>https://tekcookie.com/wordpress-website-using-docker/</link>
					<comments>https://tekcookie.com/wordpress-website-using-docker/#respond</comments>
		
		<dc:creator><![CDATA[jeffythampi]]></dc:creator>
		<pubDate>Thu, 25 Nov 2021 07:22:48 +0000</pubDate>
				<category><![CDATA[Containers]]></category>
		<category><![CDATA[Docker]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Technology]]></category>
		<guid isPermaLink="false">https://tekcookie.com/?p=4897</guid>

					<description><![CDATA[Introduction In this article, we will see how to setup a WordPress website using Docker. Containerization has changed the face of how the applications are packaged and deployed. WordPress hosting using docker containers makes it easy to host and manage the hosting. For setting up the website, a WordPress container and a SQL database container [&#8230;]]]></description>
										<content:encoded><![CDATA[				<div class="wp-block-uagb-table-of-contents uagb-toc__align-left uagb-toc__columns-1  uagb-block-832561c7     "
					data-scroll= "1"
					data-offset= "30"
					style=""
				>
				<div class="uagb-toc__wrap">
						<div class="uagb-toc__title">
							Table Of Contents						</div>
																<div class="uagb-toc__list-wrap">
						<ol class="uagb-toc__list"><li class="uagb-toc__list"><a href="#introduction" class="uagb-toc-link__trigger">Introduction</a><li class="uagb-toc__list"><a href="#prerequisites" class="uagb-toc-link__trigger">Prerequisites</a><ul class="uagb-toc__list"><li class="uagb-toc__list"><a href="#docker-engine-installation" class="uagb-toc-link__trigger">Docker engine installation</a><li class="uagb-toc__list"><li class="uagb-toc__list"><a href="#docker-compose-installation" class="uagb-toc-link__trigger">Docker-Compose installation</a><li class="uagb-toc__list"><li class="uagb-toc__list"><a href="#docker-network-configuration" class="uagb-toc-link__trigger">Docker network configuration</a></li></ul></li><li class="uagb-toc__list"><a href="#wordpress-and-mariadb-installation" class="uagb-toc-link__trigger">WordPress and MariaDB Installation</a><ul class="uagb-toc__list"><li class="uagb-toc__list"><a href="#create-necessary-folders" class="uagb-toc-link__trigger">Create necessary folders</a><li class="uagb-toc__list"><li class="uagb-toc__list"><a href="#wordpress-docker-compose-yaml" class="uagb-toc-link__trigger">WordPress Docker Compose YAML</a><li class="uagb-toc__list"><li class="uagb-toc__list"><a href="#powering-up-the-docker-containers" class="uagb-toc-link__trigger">Powering UP the docker containers</a></li></ul></li></ul></li><li class="uagb-toc__list"><a href="#summary" class="uagb-toc-link__trigger">Summary</a></ul></ul></ol>					</div>
									</div>
				</div>
			


<div style="height:50px" aria-hidden="true" class="wp-block-spacer"></div>



<h2 class="wp-block-heading">Introduction</h2>



<p>In this article, we will see how to setup a WordPress website using Docker. Containerization has changed the face of how the applications are packaged and deployed. WordPress hosting using docker containers makes it easy to host and manage the hosting.</p>



<p>For setting up the website, a WordPress container and a SQL database container are required. As we are using the containers, configurations can be fed into the containers during the creation by defining them in the Docker compose file.</p>



<div style="height:50px" aria-hidden="true" class="wp-block-spacer"></div>



<h2 class="wp-block-heading">Prerequisites</h2>



<p>A host with docker engine and docker-compose installed.</p>



<p>Here we are using Ubuntu 20.04 as the host. Docker and Docker-compose packages are installed using the below code.</p>



<div style="height:30px" aria-hidden="true" class="wp-block-spacer"></div>



<h3 class="wp-block-heading">Docker engine installation</h3>



<p>The latest stable version of the docker can be installed by executing just 2 lines of code in your Linux shell. Detailed documentation is available at&nbsp;<a href="https://docs.docker.com/engine/install/ubuntu/" target="_blank" rel="noreferrer noopener">https://docs.docker.com/engine/install/ubuntu/</a></p>



<pre class="wp-block-code"><code lang="bash" class="language-bash">curl -fsSL https://get.docker.com -o get-docker.sh
sudo sh get-docker.sh</code></pre>



<p>Add the current user (user ubuntu in my case) to the docker group</p>



<pre class="wp-block-code"><code lang="bash" class="language-bash">sudo usermod -aG docker ubuntu</code></pre>



<p>Close the session and re-login for the user to update the permission</p>



<div style="height:30px" aria-hidden="true" class="wp-block-spacer"></div>



<h3 class="wp-block-heading">Docker-Compose installation</h3>



<pre class="wp-block-code"><code lang="bash" class="language-bash">sudo apt install docker-compose -y</code></pre>



<div style="height:30px" aria-hidden="true" class="wp-block-spacer"></div>



<h3 class="wp-block-heading">Docker network configuration</h3>



<p>Two networks are defined for separating the web traffic and database connection.</p>



<pre class="wp-block-code"><code lang="bash" class="language-bash">sudo docker network create --subnet 10.10.10.0/24 data_default
sudo docker network create --subnet 10.10.11.0/24 proxy_default</code></pre>



<div style="height:50px" aria-hidden="true" class="wp-block-spacer"></div>



<h2 class="wp-block-heading">WordPress and MariaDB Installation</h2>



<p>As Docker loses its knowledge of data on reboot, the WordPress and the DB data has to be stored in a persistent storage (i.e. in a storage).</p>



<p></p>



<p>Following are the configuration details:</p>



<p><strong>WordPress</strong>:</p>



<ul class="wp-block-list"><li>Container name &#8211; testweb_wp</li><li>local data folder &#8216;/opt/data/wp_testweb/html&#8217; mapped to the wordpress container instance at &#8216;/var/www/html&#8217;</li><li>container port 80 is mapped to host port 8089</li><li>The container runs with the user account ubuntu with pid 1001(check your account puid and pgid and provide the number accordingly)</li><li>WordPress container connects to 2 bridge networks proxy_nw &gt;&gt; proxy_default and hosts_nw &gt;. data_default</li><li>and the configurations to connect to the database</li></ul>



<p><strong>MariaDB</strong>:</p>



<ul class="wp-block-list"><li>Container name &#8211; testweb_db_host</li><li>There is no port mapping to the host machine as the it communicates internally to the wordpress container</li><li>local data folder &#8216;/opt/data/wp_test/db&#8217; mapped to database container instance at &#8216;/config&#8217;</li></ul>



<div style="height:30px" aria-hidden="true" class="wp-block-spacer"></div>



<h3 class="wp-block-heading">Create necessary folders</h3>



<pre class="wp-block-code"><code lang="bash" class="language-bash">sudo mkdir /opt/data/ /opt/data/wp_testweb/ /opt/data/wp_testweb/html/ /opt/data/wp_testweb/db/</code></pre>



<div style="height:30px" aria-hidden="true" class="wp-block-spacer"></div>



<h3 class="wp-block-heading">WordPress Docker Compose YAML</h3>



<p>Create yaml file</p>



<pre class="wp-block-code"><code lang="bash" class="language-bash">cd /opt/data/wp_testweb/
sudo touch docker-compose.yaml</code></pre>



<p>Use any text editor and add the following yaml code to the docker-compose file</p>



<pre class="wp-block-code"><code lang="yaml" class="language-yaml">version: '2'
services:
  testweb_db_host:
    image: linuxserver/mariadb:latest
    networks:
      - hosts_nw
    volumes:
      - /opt/data/wp_testweb/db:/config
    environment:
      - PUID=1001
      - PGID=1001
      - MYSQL_USER=wp_user
      - MYSQL_DATABASE=testweb_db
      - MYSQL_PASSWORD=Sup35ComplexPass
      - MYSQL_ROOT_PASSWORD=^3ryComplexPass
    restart: unless-stopped
  testweb_wp:
    image: wordpress:latest
    networks:
      - proxy_nw
      - hosts_nw
    ports:
      - 8089:80
    volumes:
      - '/opt/data/wp_testweb/html:/var/www/html'
    depends_on:
      - testweb_db
    environment:
      - PUID=1001
      - PGID=1001
      - WORDPRESS_DB_HOST=testweb_db_host
      - WORDPRESS_DB_USER=wp_user
      - WORDPRESS_DB_NAME=testweb_db
      - WORDPRESS_DB_PASSWORD=Sup35ComplexPass
    restart: unless-stopped

networks:
  proxy_nw:
    external: true
    name: proxy_default
  hosts_nw:
    external: true
    name: data_default</code></pre>



<div style="height:30px" aria-hidden="true" class="wp-block-spacer"></div>



<h3 class="wp-block-heading">Powering UP the docker containers</h3>



<p>The above configuration is to be saved as docker-compose.yaml and run following command from the saved folder.</p>



<pre class="wp-block-code"><code lang="bash" class="language-bash">docker-compose up -d</code></pre>



<p>If your docker-compose fails with the following error,</p>



<pre class="wp-block-code"><code lang="bash" class="language-bash">ERROR: The Compose file './docker-compose.yaml' is invalid because:
networks.hosts_nw value Additional properties are not allowed ('name' was unexpected)
networks.proxy_nw value Additional properties are not allowed ('name' was unexpected)</code></pre>



<div style="height:30px" aria-hidden="true" class="wp-block-spacer"></div>



<p>The docker-compose has to be upgraded to the latest version. The latest stable version is now v2.1.1</p>



<pre class="wp-block-code"><code lang="bash" class="language-bash">sudo curl -L https://github.com/docker/compose/releases/download/v2.1.1/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose</code></pre>



<div style="height:30px" aria-hidden="true" class="wp-block-spacer"></div>



<p>Reboot the server for the changes to take effect and install the package  gnome-keyring </p>



<pre class="wp-block-code"><code lang="bash" class="language-bash"># To reboot the server
sudo reboot</code></pre>



<pre class="wp-block-code"><code lang="bash" class="language-bash"># Install gnome-keyring package
sudo apt install gnome-keyring</code></pre>



<p>Now execute the command again &#8220;docker-compose up -d&#8221;</p>



<div style="height:50px" aria-hidden="true" class="wp-block-spacer"></div>



<h2 class="wp-block-heading">Summary</h2>



<p>Now the containers are up and running. Verify with the command &#8221; docker ps&#8221;</p>



<pre class="wp-block-code"><code lang="bash" class="language-bash">ubuntu@dockhost:/opt/data/wp_testweb$ docker ps
CONTAINER ID   IMAGE                        COMMAND                  CREATED          STATUS          PORTS                                   NAMES
46ae07cacda9   linuxserver/mariadb:latest   "/init"                  21 seconds ago   Up 17 seconds   3306/tcp                                wp_testweb-testweb_db_host-1
15c2f3ac5099   wordpress:latest             "docker-entrypoint.s…"   23 seconds ago   Up 16 seconds   0.0.0.0:8089->80/tcp, :::8089->80/tcp   wp_testweb-testweb_wp-1</code></pre>



<div style="height:30px" aria-hidden="true" class="wp-block-spacer"></div>



<p>Open any web browser and access the URL http://&lt;ipaddress>:8089/</p>



<figure class="wp-block-image size-full is-resized"><img fetchpriority="high" decoding="async" src="//i2.wp.com/tekcookie.com/wp-content/uploads/2021/11/image-2.png" alt="" class="wp-image-4960" width="368" height="410" srcset="https://i0.wp.com/tekcookie.com/wp-content/uploads/2021/11/image-2.png?w=728&amp;ssl=1 728w, https://i0.wp.com/tekcookie.com/wp-content/uploads/2021/11/image-2.png?resize=269%2C300&amp;ssl=1 269w" sizes="(max-width: 368px) 100vw, 368px" /></figure>



<p>Well, you have your wordpress running !</p>



<div style="height:50px" aria-hidden="true" class="wp-block-spacer"></div>



<blockquote class="wp-block-quote is-layout-flow wp-block-quote-is-layout-flow"><p>Hope you like this article and thank you for reading.</p></blockquote>
]]></content:encoded>
					
					<wfw:commentRss>https://tekcookie.com/wordpress-website-using-docker/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">4897</post-id>	</item>
		<item>
		<title>Self Host BookStack using Docker</title>
		<link>https://tekcookie.com/self-host-bookstack-using-docker/</link>
					<comments>https://tekcookie.com/self-host-bookstack-using-docker/#comments</comments>
		
		<dc:creator><![CDATA[jeffythampi]]></dc:creator>
		<pubDate>Sun, 14 Nov 2021 11:17:21 +0000</pubDate>
				<category><![CDATA[Containers]]></category>
		<category><![CDATA[Docker]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Technology]]></category>
		<guid isPermaLink="false">https://tekcookie.com/?p=4862</guid>

					<description><![CDATA[For any industry, IT or non-IT, Information or data is the key. There are various ways by which the information can be stored. Financial or structured data usually takes a table form and resides in a database. In the case of the non-structured generic data such as project documentation, knowledge base or personal documentation can [&#8230;]]]></description>
										<content:encoded><![CDATA[				<div class="wp-block-uagb-table-of-contents uagb-toc__align-left uagb-toc__columns-1  uagb-block-63d8b968     "
					data-scroll= "1"
					data-offset= "30"
					style=""
				>
				<div class="uagb-toc__wrap">
						<div class="uagb-toc__title">
							Table Of Contents						</div>
																<div class="uagb-toc__list-wrap">
						<ol class="uagb-toc__list"><li class="uagb-toc__list"><a href="#introduction" class="uagb-toc-link__trigger">Introduction</a><li class="uagb-toc__list"><a href="#prerequisites" class="uagb-toc-link__trigger">Prerequisites</a><ul class="uagb-toc__list"><li class="uagb-toc__list"><a href="#linux-server" class="uagb-toc-link__trigger">Linux Server</a><li class="uagb-toc__list"><li class="uagb-toc__list"><a href="#docker-engine-installation" class="uagb-toc-link__trigger">Docker Engine Installation</a></li></ul></li><li class="uagb-toc__list"><a href="#bookstack-installation" class="uagb-toc-link__trigger">Bookstack Installation</a><ul class="uagb-toc__list"><li class="uagb-toc__list"><a href="#docker-network-configuration" class="uagb-toc-link__trigger">Docker Network configuration</a><li class="uagb-toc__list"><li class="uagb-toc__list"><a href="#database-installation" class="uagb-toc-link__trigger">Database Installation</a><li class="uagb-toc__list"><li class="uagb-toc__list"><a href="#bookstack-installation" class="uagb-toc-link__trigger">BookStack Installation</a></li></ul></li></ul></li><li class="uagb-toc__list"><a href="#final-steps" class="uagb-toc-link__trigger">Final Steps</a></ul></ul></ol>					</div>
									</div>
				</div>
			


<p>For any industry, IT or non-IT, Information or data is the key. There are various ways by which the information can be stored. Financial or structured data usually takes a table form and resides in a database. In the case of the non-structured generic data such as project documentation, knowledge base or personal documentation can be maintained well using a documentation platform rather than keeping it in files.</p>



<p>By keeping these informations in a platform, it is very easy to manage, edit, search the content as compared to the handling of files.</p>



<div style="height:50px" aria-hidden="true" class="wp-block-spacer"></div>



<h2 class="wp-block-heading">Introduction</h2>



<p>There are many such platforms out in the market which we can use. Confluence by Atlassian is one such feature-rich platform. It also does provide a free edition with 2GB storage. If you like to keep all your data with you, self hosting will be best option.</p>



<p>Of all the products, <a href="https://www.bookstackapp.com/" target="_blank" rel="noreferrer noopener">BookStack</a> is the one which I like the most. Bookstack is free and open source and the page editor has a simple WYSIWYG interface. BookStack has a very simple interface and all content can be broken down into Shelf, Books, Chapters, and Pages. It has built-in diagrams.net for easy creation of diagrams and many more.</p>



<p>In this article, we will discuss how to self-host BookStack in docker.</p>



<div style="height:50px" aria-hidden="true" class="wp-block-spacer"></div>



<h2 class="wp-block-heading">Prerequisites</h2>



<div style="height:20px" aria-hidden="true" class="wp-block-spacer"></div>



<h3 class="wp-block-heading">Linux Server</h3>



<p>The prerequisite is to have a Linux OS either in a public cloud or in your home server. Here I am using Ubuntu 20.04.</p>



<div style="height:30px" aria-hidden="true" class="wp-block-spacer"></div>



<h3 class="wp-block-heading">Docker Engine Installation</h3>



<p>The latest stable version of the docker can be installed by executing just 2 lines of code in your Linux shell. Detailed documentation is available at <a href="https://docs.docker.com/engine/install/ubuntu/" target="_blank" rel="noreferrer noopener"><span style="text-decoration: underline;">https://docs.docker.com/engine/install/ubuntu/</span></a></p>



<pre class="wp-block-code"><code lang="bash" class="language-bash">curl -fsSL https://get.docker.com -o get-docker.sh
sudo sh get-docker.sh</code></pre>



<p>Add the current user (user ubuntu in my case) to the docker group</p>



<pre class="wp-block-code"><code lang="bash" class="language-bash">sudo usermod -aG docker ubuntu</code></pre>



<p>Close the session and re-login for the user to update the permission</p>



<div style="height:50px" aria-hidden="true" class="wp-block-spacer"></div>



<h2 class="wp-block-heading">Bookstack Installation</h2>



<p>Bookstack uses a SQL database to store the data. We use MariaDB as our database. Both the BookStack and MariaDB docker container images are from <a href="https://www.linuxserver.io/" target="_blank" rel="noreferrer noopener"><span style="text-decoration: underline;">https://www.linuxserver.io/</span></a></p>



<div style="height:30px" aria-hidden="true" class="wp-block-spacer"></div>



<h3 class="wp-block-heading">Docker Network configuration</h3>



<p>Let&#8217;s create a network the containers</p>



<pre class="wp-block-code"><code lang="bash" class="language-bash">sudo docker network create --subnet 10.10.10.0/24 data_default</code></pre>



<div style="height:30px" aria-hidden="true" class="wp-block-spacer"></div>



<h3 class="wp-block-heading">Database Installation</h3>



<p>Execute the below docker command to install the DB container.</p>



<pre class="wp-block-code"><code lang="bash" class="language-bash">docker run -d \
--name=bookstackdb \
-e PUID=1001 \
-e PGID=1001 \
-e MYSQL_ROOT_PASSWORD=pass123456 \
-e MYSQL_DATABASE=bookstackapp \
-e MYSQL_USER=bookstackuser \
-e MYSQL_PASSWORD=pass123456997 \
-v /opt/data/bookstack/db:/config \
--restart unless-stopped \
--network=data_default \
linuxserver/mariadb</code></pre>



<p>Running the above command will download the MariaDB image and create a container from the repository and run it with the specified configuration as mentioned in the environment variables. The container will be attached to the data_default network with the name bookstackdb.</p>



<p>The data folder will be created  &#8220;/opt/data/bookstack/db&#8221; if not already exist.</p>



<div style="height:30px" aria-hidden="true" class="wp-block-spacer"></div>



<h3 class="wp-block-heading">BookStack Installation</h3>



<p> Execute the below docker command to install the BookStack container</p>



<pre class="wp-block-code"><code lang="bash" class="language-bash">docker run -d \
--name=bookstack \
-e PUID=1001 \
-e PGID=1001 \
-e DB_HOST=bookstackdb \
-e DB_USER=bookstackuser \
-e DB_PASS=pass123456997  \
-e DB_DATABASE=bookstackapp \
-e APP_URL=http://wiki.yourdomain.com:5865 \
-p 5865:80 \
-v /opt/data/bookstack/config:/config \
--restart unless-stopped \
--network=data_default \
linuxserver/bookstack</code></pre>



<p>Make sure to properly configure the environment variables such as &#8211; database user and password, URL, port, etc.</p>



<p>To check the container status, run &#8220;docker ps&#8221; and it should show the below result. Book stack is listening at port 5865.</p>



<pre class="wp-block-code"><code class="">ubuntu@webserver:/opt/data/bookstack$ docker ps
CONTAINER ID   IMAGE                   COMMAND   CREATED          STATUS          PORTS                                            NAMES
33effffbf170   linuxserver/bookstack   "/init"   3 minutes ago    Up 2 minutes    443/tcp, 0.0.0.0:5865-&gt;80/tcp, :::5865-&gt;80/tcp   bookstack
b7540622f83b   linuxserver/mariadb     "/init"   25 minutes ago   Up 25 minutes   3306/tcp                                         bookstackdb
</code></pre>



<p>Make necessary DNS entry to point the domain wiki.domain.com to the virtual machine IP and all set. BookStack is ready for use.</p>



<div style="height:50px" aria-hidden="true" class="wp-block-spacer"></div>



<h2 class="wp-block-heading">Final Steps</h2>



<p>Open any web browser and type in the URL http://wiki.yourdomain.com:5865 to access your wiki site.</p>



<p>This should take us to the BookStack login </p>



<figure class="wp-block-image size-full"><img decoding="async" width="885" height="613" src="//i1.wp.com/tekcookie.com/wp-content/uploads/2021/11/image-1.png" alt="" class="wp-image-4869" srcset="https://i0.wp.com/tekcookie.com/wp-content/uploads/2021/11/image-1.png?w=885&amp;ssl=1 885w, https://i0.wp.com/tekcookie.com/wp-content/uploads/2021/11/image-1.png?resize=300%2C208&amp;ssl=1 300w, https://i0.wp.com/tekcookie.com/wp-content/uploads/2021/11/image-1.png?resize=768%2C532&amp;ssl=1 768w" sizes="(max-width: 885px) 100vw, 885px" /></figure>



<p>The default admin login of BookStack is <strong>admin@admin.com</strong> with the password <strong>password</strong></p>



<p>Ensure to change the login email and the password after you login. Refer to the BookStack documentation <a href="https://www.bookstackapp.com/docs/admin/security/" target="_blank" rel="noreferrer noopener"><span style="text-decoration: underline;">https://www.bookstackapp.com/docs/admin/security/</span></a> for further configuration</p>



<div style="height:50px" aria-hidden="true" class="wp-block-spacer"></div>



<blockquote class="wp-block-quote is-layout-flow wp-block-quote-is-layout-flow"><p></p><cite>Hope you liked this article and thank you for reading</cite></blockquote>
]]></content:encoded>
					
					<wfw:commentRss>https://tekcookie.com/self-host-bookstack-using-docker/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">4862</post-id>	</item>
		<item>
		<title>Create PFX Certificate File from RSA Keys</title>
		<link>https://tekcookie.com/create-pfx-certificate-file-from-rsa-keys/</link>
					<comments>https://tekcookie.com/create-pfx-certificate-file-from-rsa-keys/#respond</comments>
		
		<dc:creator><![CDATA[jeffythampi]]></dc:creator>
		<pubDate>Sat, 03 Jul 2021 14:03:13 +0000</pubDate>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[SSL/TLS]]></category>
		<category><![CDATA[PFX file from RSA Keys]]></category>
		<category><![CDATA[PFX from Private and Public RSA Keys]]></category>
		<category><![CDATA[PFX from RSA Keys]]></category>
		<guid isPermaLink="false">https://tekcookie.com/?p=3623</guid>

					<description><![CDATA[In this article, we will see how to generate pfx certificate from Public and Private RSA keys. This is done with OpenSSL tool. OpenSSL is available at https://www.openssl.org/source/ Once installed, OpenSSL is accessed using command prompt. Generate PFX from Private and Public RSA Keys In this example the certificate has only the private key and [&#8230;]]]></description>
										<content:encoded><![CDATA[
<p>In this article, we will see how to generate pfx certificate from Public and Private RSA keys. This is done with OpenSSL tool.</p>



<p>OpenSSL is available at <a href="https://www.openssl.org/source/" target="_blank" rel="noopener">https://www.openssl.org/source/</a></p>



<p>Once installed, OpenSSL is accessed using command prompt.</p>



<div style="height:50px" aria-hidden="true" class="wp-block-spacer"></div>



<h2 class="wp-block-heading">Generate PFX from Private and Public RSA Keys</h2>



<p>In this example the certificate has only the private key and the public key but not the information of intermediate or root CA.</p>



<p>Below are the file list</p>



<ul class="wp-block-list"><li>Private Key – <em>csc_private.key</em></li></ul>



<ul class="wp-block-list"><li>Public Key – <em>csc_public.pem</em></li></ul>



<figure class="wp-block-image size-large is-resized"><img data-recalc-dims="1" decoding="async" src="https://i0.wp.com/tekcookie.com/wp-content/uploads/2021/07/cert_files.jpg?resize=863%2C286&#038;ssl=1" alt="" class="wp-image-3624" width="863" height="286" srcset="https://i0.wp.com/tekcookie.com/wp-content/uploads/2021/07/cert_files.jpg?w=1001&amp;ssl=1 1001w, https://i0.wp.com/tekcookie.com/wp-content/uploads/2021/07/cert_files.jpg?resize=300%2C100&amp;ssl=1 300w, https://i0.wp.com/tekcookie.com/wp-content/uploads/2021/07/cert_files.jpg?resize=768%2C255&amp;ssl=1 768w" sizes="(max-width: 863px) 100vw, 863px" /></figure>



<div style="height:50px" aria-hidden="true" class="wp-block-spacer"></div>



<p>With OpenSSL, the key can be converted to PFX format.</p>



<p>Open command prompt and enter the below command</p>



<pre class="wp-block-code"><code lang="bash" class="language-bash">openssl pkcs12 -export -out ClientCert.pfx -inkey "C:\Cert\csc_private.key" -in "C:\Cert\csc_public.pem" </code></pre>



<p>This command will prompt to enter the password to secure the certificate. After entering the password, the certificate will be generated.</p>



<figure class="wp-block-image size-large"><img data-recalc-dims="1" decoding="async" width="857" height="118" src="https://i0.wp.com/tekcookie.com/wp-content/uploads/2021/07/gen-cert-file.jpg?resize=857%2C118&#038;ssl=1" alt="" class="wp-image-3626" srcset="https://i0.wp.com/tekcookie.com/wp-content/uploads/2021/07/gen-cert-file.jpg?w=857&amp;ssl=1 857w, https://i0.wp.com/tekcookie.com/wp-content/uploads/2021/07/gen-cert-file.jpg?resize=300%2C41&amp;ssl=1 300w, https://i0.wp.com/tekcookie.com/wp-content/uploads/2021/07/gen-cert-file.jpg?resize=768%2C106&amp;ssl=1 768w" sizes="(max-width: 857px) 100vw, 857px" /></figure>



<div style="height:50px" aria-hidden="true" class="wp-block-spacer"></div>



<p>After the command execution, the certificate file is generated with the name &#8220;ClientCert.pfx&#8221; as mentioned in the -out parameter in the openssl command.</p>



<p>If certificate chain has to added to the pfx file, then the root and intermediate files can be appended to end of the above command as separate -in parameter. For example &#8221; -in rootCA.pem -in intermCA.pem&#8221;</p>



<div style="height:50px" aria-hidden="true" class="wp-block-spacer"></div>



<blockquote class="wp-block-quote is-layout-flow wp-block-quote-is-layout-flow"><p>Hope you liked this article and thank you for reading.</p></blockquote>



<p></p>
]]></content:encoded>
					
					<wfw:commentRss>https://tekcookie.com/create-pfx-certificate-file-from-rsa-keys/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">3623</post-id>	</item>
		<item>
		<title>Get Local Administrator Group Members From Remote Computers</title>
		<link>https://tekcookie.com/local-administrator-group-members-from-remote-computers/</link>
					<comments>https://tekcookie.com/local-administrator-group-members-from-remote-computers/#comments</comments>
		
		<dc:creator><![CDATA[jeffythampi]]></dc:creator>
		<pubDate>Sun, 27 Jun 2021 09:33:13 +0000</pubDate>
				<category><![CDATA[Windows]]></category>
		<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[Technology]]></category>
		<guid isPermaLink="false">https://tekcookie.com/?p=3422</guid>

					<description><![CDATA[In this article, we will discuss how to get a consolidated list of local administrators group members from remote computers. We use powersell command-let invoke-command to execute the command in the remote systems. Invoke-Command is the most used command-let to execute scripts remotely. To use Invoke-Command, powershell remoting has to be enabled in the remote [&#8230;]]]></description>
										<content:encoded><![CDATA[
<p>In this article, we will discuss how to get a consolidated list of local administrators group members from remote computers.</p>


				<div class="wp-block-uagb-table-of-contents uagb-toc__align-left uagb-toc__columns-1  uagb-block-5f24a1d4     "
					data-scroll= "1"
					data-offset= "30"
					style=""
				>
				<div class="uagb-toc__wrap">
						<div class="uagb-toc__title">
							Summary of Article<br>						</div>
																<div class="uagb-toc__list-wrap">
						<ol class="uagb-toc__list"><li class="uagb-toc__list"><a href="#one-liner-to-fetch-local-administrator-group-details" class="uagb-toc-link__trigger">One liner to fetch local administrator group details</a><li class="uagb-toc__list"><a href="#script-to-fetch-the-local-administrator-group-details" class="uagb-toc-link__trigger">Script to fetch the local administrator group details</a></ol>					</div>
									</div>
				</div>
			


<div style="height:50px" aria-hidden="true" class="wp-block-spacer"></div>



<p>We use powersell command-let invoke-command to execute the command in the remote systems. Invoke-Command is the most used command-let to execute scripts remotely.</p>



<p>To use Invoke-Command, powershell remoting has to be enabled in the remote system. Group policy can be used to deploy this feature in the organization.</p>



<div style="height:50px" aria-hidden="true" class="wp-block-spacer"></div>



<h2 class="wp-block-heading">One liner to fetch local administrator group details</h2>



<pre class="wp-block-code"><code lang="powershell" class="language-powershell">Invoke-Command -ScriptBlock { Get-LocalGroupMember administrators } -ComputerName pc1, pc2, pc3 | select PSComputerName, Name, SID, PrincipalSource</code></pre>



<div style="height:40px" aria-hidden="true" class="wp-block-spacer"></div>



<p>Result:</p>



<div class="wp-block-group has-white-color has-text-color has-background is-layout-flow wp-block-group-is-layout-flow" style="background-color:#d5d5d5">
<div class="wp-block-columns is-layout-flex wp-container-core-columns-is-layout-9d6595d7 wp-block-columns-is-layout-flex">
<div class="wp-block-column is-layout-flow wp-block-column-is-layout-flow">
<pre id="block-285fd92c-5223-4dec-99b0-497b5d7c3fe9" class="wp-block-preformatted wp-block-code block-editor-block-list__block wp-block is-selected"><code><span style="color:#13608c" class="has-inline-color">PSComputerName Name                 SID                                            PrincipalSource
 -------------- ----                 ---                                            ---------------
 pc1            pc1\Administrator    S-1-5-21-1644265705-1531034170-3899888674-500  Local          
 pc1            pc1\user             S-1-5-21-1644265705-1531034170-3899888674-1002 Local          
 pc2            pc2\Administrator    S-1-5-21-1644265705-1531034170-3899899674-500  Local          
 pc3            pc3\Administrator    S-1-5-21-1644265705-1531034170-3899875674-500  Local  </span></code></pre>



<p></p>
</div>
</div>
</div>



<div style="height:40px" aria-hidden="true" class="wp-block-spacer"></div>



<p></p>



<p>This one liner will connect to the respective computers mentioned in the ComputerName parameter and lists out the member details. The PrincipalSource shows whether the object belongs to local or domain. </p>



<blockquote class="wp-block-quote is-layout-flow wp-block-quote-is-layout-flow"><p>Note: As the script will connect to the remote computers, we need to run it with a user account which has access to these machines.</p></blockquote>



<p>Get-LocalGroupMember command-let is part of Microsoft.PowerShell.LocalAccounts and was made available from the version Powershell 5.1.</p>



<p>Further details of al commands are documented at <a href="https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.localaccounts/?view=powershell-5.1" target="_blank" rel="noreferrer noopener">https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.localaccounts/?view=powershell-5.1</a></p>



<div style="height:50px" aria-hidden="true" class="wp-block-spacer"></div>



<h2 class="wp-block-heading">Script to fetch the local administrator group details</h2>



<p>We will now wrap the above one liner to a function with the necessary checks to ensure that the computers are online by checking with a ping request.</p>



<pre class="wp-block-code"><code lang="powershell" class="language-powershell line-numbers">function Fetch-LocalAdminMembers
 {
     [CmdletBinding()]
     [Alias()]
     Param
     (
         [Parameter(Mandatory=$true)]
         [String[]]$Computers,
         [Parameter()]
         [pscredential]$Credential
     )
     begin
     {
         #Checking whether the systems are online
         #OnlineComputers variable will have all the computers which responded to ping
         $OnlineComputers = @()
         $Computers | ForEach-Object {
             if(Test-Connection $_ -Count 1 -ErrorAction SilentlyContinue) {
                 $OnlineComputers += $_
             }
         }

     }

     process
     {
         #If credentials are not passed, the script runs in current user context
         if($Credential -eq $null)
         {
             Invoke-Command -ScriptBlock {Get-LocalGroupMember administrators; Start-Sleep -Seconds 2} -ComputerName $OnlineComputers   | select PSComputerName, Name, SID, PrincipalSource
         }
         else
         {
             Invoke-Command -ScriptBlock {Get-LocalGroupMember administrators; Start-Sleep -Seconds 2} -ComputerName $OnlineComputers -Credential $Credential  | select PSComputerName, Name, SID, PrincipalSource
         }
     }

     end
     {
         $OnlineComputers = $Credential = $null
     }
 }
</code></pre>



<div style="height:40px" aria-hidden="true" class="wp-block-spacer"></div>



<p>Executing the function</p>



<p>Fetch-LocalAdminMembers -Computers pc1, pc2</p>



<p>Result:</p>



<div class="wp-block-group has-background is-layout-flow wp-block-group-is-layout-flow" style="background-color:#d5d5d5">
<pre class="wp-block-preformatted"><code><span style="color:#13608c" class="has-inline-color">PSComputerName Name                 SID                                            PrincipalSource
 -------------- ----                 ---                                            ---------------
 pc1           pc1\Administrator    S-1-5-21-1644265705-1531034170-3899888674-500  Local          
 pc1           pc1\user             S-1-5-21-1644265705-1531034170-3899888674-1002 Local          
 pc2           pc2\Administrator    S-1-5-21-1644265705-1531034170-3894649674-500  Local          
 pc2           pc2\user2            S-1-5-21-1644265705-1531034170-<code>3894649674</code>-1002 Local </span></code> </pre>
</div>



<div style="height:40px" aria-hidden="true" class="wp-block-spacer"></div>



<p>We can refine the script further for faster execution, If you can identify it, I highly recommend you to comment it with the code snippet. </p>



<p>This will be helpful for the readers and will make this more interactive.<mark class="annotation-text annotation-text-yoast" id="annotation-text-403cec01-8321-4572-8a73-ef18fa2383d0"></mark></p>



<div style="height:40px" aria-hidden="true" class="wp-block-spacer"></div>



<blockquote class="wp-block-quote is-layout-flow wp-block-quote-is-layout-flow"><p>Hope you liked the article and thank you for reading</p></blockquote>
]]></content:encoded>
					
					<wfw:commentRss>https://tekcookie.com/local-administrator-group-members-from-remote-computers/feed/</wfw:commentRss>
			<slash:comments>2</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">3422</post-id>	</item>
		<item>
		<title>Windows Update Information On Remote Servers with Powershell</title>
		<link>https://tekcookie.com/windows-update-information/</link>
					<comments>https://tekcookie.com/windows-update-information/#respond</comments>
		
		<dc:creator><![CDATA[jeffythampi]]></dc:creator>
		<pubDate>Fri, 18 Jun 2021 13:20:28 +0000</pubDate>
				<category><![CDATA[Windows]]></category>
		<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[Windows 10]]></category>
		<category><![CDATA[Windows Server 2016]]></category>
		<category><![CDATA[Windows update details]]></category>
		<category><![CDATA[Windows Update Information with Powershell]]></category>
		<guid isPermaLink="false">https://tekcookie.com/?p=3198</guid>

					<description><![CDATA[In this article we will see how to use powershell script to get update information of remote windows servers. Last Windows Update Information We use the com object Microsoft.Update.Session to get the update results. Below one liner will tell us the previous update search and the last update installation date. Output: LastSearchSuccessDate LastInstallationSuccessDate --------------------- --------------------------- [&#8230;]]]></description>
										<content:encoded><![CDATA[
<p>In this article we will see how to use powershell script to get update information of remote windows servers.</p>


				<div class="wp-block-uagb-table-of-contents uagb-toc__align-left uagb-toc__columns-1  uagb-block-3d8d94d9     "
					data-scroll= "1"
					data-offset= "30"
					style=""
				>
				<div class="uagb-toc__wrap">
						<div class="uagb-toc__title">
							Table Of Contents						</div>
																<div class="uagb-toc__list-wrap">
						<ol class="uagb-toc__list"><li class="uagb-toc__list"><a href="#last-windows-update-information" class="uagb-toc-link__trigger">Last Windows Update Information</a><li class="uagb-toc__list"><a href="#new-windows-update-count" class="uagb-toc-link__trigger">New Windows Update Count</a><li class="uagb-toc__list"><a href="#pending-operating-system-restart" class="uagb-toc-link__trigger">Pending Operating System Restart</a><li class="uagb-toc__list"><a href="#windows-update-status" class="uagb-toc-link__trigger">Windows Update Status</a></ol>					</div>
									</div>
				</div>
			


<div style="height:30px" aria-hidden="true" class="wp-block-spacer"></div>



<p></p>



<h2 class="wp-block-heading">Last Windows Update Information</h2>



<p>We use the com object Microsoft.Update.Session to get the update results.</p>



<p>Below one liner will tell us the previous update search and the last update installation date.</p>



<pre class="wp-block-code"><code lang="powershell" class="language-powershell">(New-Object -com "Microsoft.Update.AutoUpdate").Results
</code></pre>



<p>Output:</p>



<pre class="wp-block-preformatted">LastSearchSuccessDate LastInstallationSuccessDate
--------------------- --------------------------- 
 6/17/2021 3:54:31 AM  6/16/2021 3:57:34 AM</pre>



<div style="height:30px" aria-hidden="true" class="wp-block-spacer"></div>



<h2 class="wp-block-heading">New Windows Update Count</h2>



<p>Furthermore, to get the number of updates which are yet to be installed.</p>



<pre class="wp-block-code"><code lang="powershell" class="language-powershell">$UpdateSession = New-Object -ComObject Microsoft.Update.Session
$UpdateSearcher = $UpdateSession.CreateupdateSearcher()
$Updates = @($UpdateSearcher.Search("IsInstalled=0").Updates)

#This will give the number of updates yet to install.
$Updates.Title.count </code></pre>



<div style="height:30px" aria-hidden="true" class="wp-block-spacer"></div>



<h2 class="wp-block-heading">Pending Operating System Restart</h2>



<p>Any pending restart because of previous update can be identified through the registry &#8220;HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update\RebootRequired&#8221;</p>



<p>The entry will have a value &#8220;true&#8221; if the operating system is waiting for a restart which is needed to complete an update.</p>



<div style="height:30px" aria-hidden="true" class="wp-block-spacer"></div>



<h2 class="wp-block-heading">Windows Update Status</h2>



<p>Above codes can be combined to get following information about a computer. </p>



<ol class="wp-block-list"><li>LastSearchSuccessDate</li><li>LastInstallationSuccessDate</li><li>NewUpdateCount</li><li>PendingReboot</li></ol>



<p>We can now wrap the script with invoke-command to remote execute in multiple systems</p>



<pre class="wp-block-code"><code lang="powershell" class="language-powershell">function Get-WindowsUpdateInformation()
 {
     param
     (
         [Parameter()]
         [string[]]
         $ComputerName="localhost"
     )


     <code>$Results = Invoke-Command -ScriptBlock  {     </code>
         <code>$result = (New-Object -com "Microsoft.Update.AutoUpdate").Results     </code>
         <code>$UpdateSession = New-Object -ComObject Microsoft.Update.Session     </code>
         <code>$UpdateSearcher = $UpdateSession.CreateupdateSearcher()     </code>
         <code>$Updates = @($UpdateSearcher.Search("IsInstalled=0").Updates)     </code>
         <code>$PendingReboot = $false     </code>
    
         #Checking pending reboot
         <code>if (Get-Item "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update\RebootRequired" -EA Ignore) { $PendingReboot=$true }     </code>
   
         #Framing the result to a list
         <code>New-Object psobject -Property @{         </code>
              <code>LastSearchSuccessDate = $result.LastSearchSuccessDate         </code>
              <code>LastInstallationSuccessDate = $result.LastInstallationSuccessDate         </code>
              <code>NewUpdateCount = $Updates.Title.count         </code>
              <code>PendingReboot = $PendingReboot     </code>
         <code>} </code>
     <code>} -ComputerName $ComputerName </code>

     <code>$Results | Select-Object @{Name="ServerName"; Expression={$_.PSComputerName}}, LastSearchSuccessDate, LastInstallationSuccessDate, NewUpdateCount, PendingReboot</code>
 }
 </code></pre>



<p>Multiple server/computer names can be passed as an array to get the update information, or the server name can also be read from a text file and passed as parameter.</p>



<pre id="block-a18e501e-39e5-40fa-91ad-224e419f395c" class="wp-block-preformatted">Get-WindowsUpdateInformation -ComputerName testhost1, testhost2</pre>



<p>Output:</p>



<pre class="wp-block-preformatted">ServerName LastSearchSuccessDate LastInstallationSuccessDate NewUpdateCount PendingReboot
---------- --------------------- --------------------------- -------------- -------------
 testhost1  6/17/2021 5:31:12 PM  5/16/2021 2:56:21 PM                     1         False
 testhost2  6/16/2021 6:33:22 PM  5/21/2021 4:22:34 AM                     1         False</pre>



<div style="height:30px" aria-hidden="true" class="wp-block-spacer"></div>



<p>If you have some better ideas or know other ways of doing this, please comment it. It will be informative for me and for the readers.</p>



<div style="height:30px" aria-hidden="true" class="wp-block-spacer"></div>



<blockquote class="wp-block-quote is-layout-flow wp-block-quote-is-layout-flow"><p>Hope you liked this article and thank you for reading</p></blockquote>
]]></content:encoded>
					
					<wfw:commentRss>https://tekcookie.com/windows-update-information/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">3198</post-id>	</item>
		<item>
		<title>Dynamic DNS with CloudFlare and PowerShell</title>
		<link>https://tekcookie.com/dynamic-dns-with-cloudflare-and-powershell/</link>
					<comments>https://tekcookie.com/dynamic-dns-with-cloudflare-and-powershell/#comments</comments>
		
		<dc:creator><![CDATA[jeffythampi]]></dc:creator>
		<pubDate>Sun, 14 Feb 2021 15:07:53 +0000</pubDate>
				<category><![CDATA[DNS]]></category>
		<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[Cloudflare]]></category>
		<category><![CDATA[cloudflare api]]></category>
		<category><![CDATA[cloudflare api using PowerShell]]></category>
		<category><![CDATA[DDNS]]></category>
		<category><![CDATA[Dynamic DNS]]></category>
		<guid isPermaLink="false">https://tekcookie.com/?p=1900</guid>

					<description><![CDATA[CloudFlare does provide free plan where one can add one domain and proxy the traffic for FREE. Cloudflare also do give the provision to manage the domain using API&#8217;s. We will see how to create a DNS record and update the record using PowerShell. To manage the DNS record in cloudflare, we need to obtain [&#8230;]]]></description>
										<content:encoded><![CDATA[				<div class="wp-block-uagb-table-of-contents uagb-toc__align-left uagb-toc__columns-1  uagb-block-d6b5e917     "
					data-scroll= "1"
					data-offset= "30"
					style=""
				>
				<div class="uagb-toc__wrap">
						<div class="uagb-toc__title">
							Table Of Contents						</div>
																<div class="uagb-toc__list-wrap">
						<ol class="uagb-toc__list"><li class="uagb-toc__list"><a href="#validating-cloudflare-api-key-using-powershell" class="uagb-toc-link__trigger">Validating cloudflare API key using Powershell</a><li class="uagb-toc__list"><a href="#adding-a-new-record-to-cloudflare-dns" class="uagb-toc-link__trigger">Adding a new record to Cloudflare DNS</a><li class="uagb-toc__list"><a href="#edit-an-existing-cloudflare-dns-record" class="uagb-toc-link__trigger">Edit an existing Cloudflare DNS record</a></ol>					</div>
									</div>
				</div>
			


<div style="height:30px" aria-hidden="true" class="wp-block-spacer"></div>



<p>CloudFlare does provide free plan where one can add one domain and proxy the traffic for FREE. Cloudflare also do give the provision to manage the domain using API&#8217;s.</p>



<p>We will see how to create a DNS record and update the record using PowerShell.</p>



<p>To manage the DNS record in cloudflare, we need to obtain the API token and permission to edit the DNS records.</p>



<div style="height:30px" aria-hidden="true" class="wp-block-spacer"></div>



<p>To obtain the API token, login to cloudflare, under your domain portal, click on &#8220;Get your API token&#8221;. Also note the &#8220;Zone Id&#8221; in the page, which is required in the API.</p>



<figure class="wp-block-image size-large"><img data-recalc-dims="1" decoding="async" width="781" height="900" src="https://i0.wp.com/tekcookie.com/wp-content/uploads/2021/02/image-1.png?resize=781%2C900&#038;ssl=1" alt="" class="wp-image-2803" srcset="https://i0.wp.com/tekcookie.com/wp-content/uploads/2021/02/image-1.png?w=781&amp;ssl=1 781w, https://i0.wp.com/tekcookie.com/wp-content/uploads/2021/02/image-1.png?resize=260%2C300&amp;ssl=1 260w, https://i0.wp.com/tekcookie.com/wp-content/uploads/2021/02/image-1.png?resize=768%2C885&amp;ssl=1 768w" sizes="(max-width: 781px) 100vw, 781px" /></figure>



<div style="height:50px" aria-hidden="true" class="wp-block-spacer"></div>



<p>Click on &#8220;API Tokens&#8221; tab and click &#8220;Create Token&#8221; button. </p>



<figure class="wp-block-image size-large"><img data-recalc-dims="1" decoding="async" src="https://i0.wp.com/tekcookie.com/wp-content/uploads/2021/02/image-2.png?w=1080&#038;ssl=1" alt="" class="wp-image-1904"/></figure>



<div style="height:50px" aria-hidden="true" class="wp-block-spacer"></div>



<p>click the &#8220;Use Template&#8221; button as shown below.</p>



<figure class="wp-block-image size-large"><img data-recalc-dims="1" decoding="async" src="https://i0.wp.com/tekcookie.com/wp-content/uploads/2021/02/image-3.png?w=1080&#038;ssl=1" alt="" class="wp-image-1905"/></figure>



<div style="height:50px" aria-hidden="true" class="wp-block-spacer"></div>



<p>Select the zone setings as below with the required domain details and click &#8220;Continue to summary&#8221;</p>



<figure class="wp-block-image size-large"><img data-recalc-dims="1" decoding="async" src="https://i0.wp.com/tekcookie.com/wp-content/uploads/2021/02/image-4.png?w=1080&#038;ssl=1" alt="" class="wp-image-1906"/></figure>



<div style="height:50px" aria-hidden="true" class="wp-block-spacer"></div>



<p>Click &#8220;Create Token&#8221; to generate the api key. </p>



<figure class="wp-block-image size-large"><img data-recalc-dims="1" decoding="async" src="https://i0.wp.com/tekcookie.com/wp-content/uploads/2021/02/image-5.png?w=1080&#038;ssl=1" alt="" class="wp-image-1907"/></figure>



<div style="height:50px" aria-hidden="true" class="wp-block-spacer"></div>



<p>Copy the generated key to access the DNS using PowerShell.</p>



<pre class="wp-block-preformatted">Sample Token : p6bfghn0rsdfghc-34ggb5tdas8w7ysdftj-C4
Sample ZoneID : 6cd345qefad7c71dfg5q23573017</pre>



<div style="height:50px" aria-hidden="true" class="wp-block-spacer"></div>



<h2 class="wp-block-heading">Validating cloudflare API key using Powershell</h2>



<p>Run the below script in PowerShell to validate the access</p>



<pre class="wp-block-code"><code lang="powershell" class="language-powershell">Invoke-RestMethod -Method Get -Uri "https://api.cloudflare.com/client/v4/user/tokens/verify" -Headers @{
 "Authorization" = "Bearer p6bfghn0rsdfghc-34ggb5tdas8w7ysdftj-C4"
 "Content-Type" = "application/json"
 } </code></pre>



<p>Result with success = True shows that the key is valid and accepted.</p>



<figure class="wp-block-image size-large"><img data-recalc-dims="1" decoding="async" src="https://i0.wp.com/tekcookie.com/wp-content/uploads/2021/02/image-6.png?w=1080&#038;ssl=1" alt="" class="wp-image-1912"/></figure>



<div style="height:50px" aria-hidden="true" class="wp-block-spacer"></div>



<p>To know your public IP,  please refer to my other post</p>



<figure class="wp-block-embed is-type-wp-embed is-provider-tekcookie wp-block-embed-tekcookie"><div class="wp-block-embed__wrapper">
<blockquote class="wp-embedded-content" data-secret="JkZMdlu1S7"><a href="https://tekcookie.com/get-your-public-ip-using-powershell/">Get your Public IP using PowerShell</a></blockquote><iframe class="wp-embedded-content" sandbox="allow-scripts" security="restricted"  title="&#8220;Get your Public IP using PowerShell&#8221; &#8212; TekCookie" src="https://tekcookie.com/get-your-public-ip-using-powershell/embed/#?secret=JkZMdlu1S7" data-secret="JkZMdlu1S7" width="600" height="338" frameborder="0" marginwidth="0" marginheight="0" scrolling="no"></iframe>
</div></figure>



<div style="height:50px" aria-hidden="true" class="wp-block-spacer"></div>



<h2 class="wp-block-heading">Adding a new record to Cloudflare DNS</h2>



<pre class="wp-block-code"><code lang="powershell" class="language-powershell"> $token = "p6bfghn0rsdfghc-34ggb5tdas8w7ysdftj-C4"
 $hostname = "dyDNS.domain.com"
 $ip = Invoke-RestMethod -uri "https://ifconfig.io/ip"  #Your Public IP 
 $zoneid = "6cd345qefad7c71dfg5q23573017"
 $url = "https://api.clouflare.com/client/v4/zones/$zoneid/dns_records"

 $Body = @{
     "type" = "A"
     "name" =  $hostname
     "content" = $ip
     "proxied" = $true # To mask the real IP
 }

 $Body = $Body | ConvertTo-Json

 $result = Invoke-RestMethod -Method post -Uri $url -Headers @{
 "Authorization" = "Bearer p6bfghn0rsdfghc-34ggb5tasdas8w7ysdftj-C4"
 } -Body $Body -ContentType "application/json"

 $result.result</code></pre>



<div style="height:50px" aria-hidden="true" class="wp-block-spacer"></div>



<h2 class="wp-block-heading">Edit an existing Cloudflare DNS record</h2>



<pre class="wp-block-code"><code lang="powershell" class="language-powershell"> $hostname = "dyDNS.domain.com"
 $zoneid = "6cd345qefad7c71dfg5q23573017"
 $token = "p6bfghn0rsdfghc-34ggb5tdas8w7ysdftj-C4"
 $url = "https://api.cloudflare.com/client/v4/zones/$zoneid/dns_records" 

 # Fetch the record information
 $record_data = Invoke-RestMethod -Method get -Uri "$url/?name=$hostname" -Headers @{
 "Authorization" = "Bearer $token"
 } 

 # Modify the IP from the fetched record
 $record_ID = $record_data.result[0].id
 $record_data.result[0].content = Invoke-RestMethod -uri "https://ifconfig.io/ip" #Your Public IP 

 $body = $record_data.result[0] | ConvertTo-Json

 # Update the record
 $result = Invoke-RestMethod -Method put -Uri "$url/$record_ID" -Headers @{
 "Authorization" = "Bearer $token"
 } -Body $body -ContentType "application/json"</code></pre>



<p>Run this script in a Scheduled Task, your Public IP will get updated in DNS !!!</p>



<div style="height:30px" aria-hidden="true" class="wp-block-spacer"></div>



<blockquote class="wp-block-quote is-layout-flow wp-block-quote-is-layout-flow"><p>Hope you like this article and thank you for reading.</p></blockquote>



<p></p>
]]></content:encoded>
					
					<wfw:commentRss>https://tekcookie.com/dynamic-dns-with-cloudflare-and-powershell/feed/</wfw:commentRss>
			<slash:comments>3</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">1900</post-id>	</item>
		<item>
		<title>Get your Public IP using PowerShell</title>
		<link>https://tekcookie.com/get-your-public-ip-using-powershell/</link>
					<comments>https://tekcookie.com/get-your-public-ip-using-powershell/#respond</comments>
		
		<dc:creator><![CDATA[jeffythampi]]></dc:creator>
		<pubDate>Sat, 13 Feb 2021 15:38:33 +0000</pubDate>
				<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[Public IP]]></category>
		<category><![CDATA[Public IP using PowerShell]]></category>
		<guid isPermaLink="false">https://tekcookie.com/?p=1916</guid>

					<description><![CDATA[The devices behind a modem or an internet router will be assigned with private ip for communication within the internal network. When these devices needed to communicate to the outside world, the modem/router translate the private IP address to the public IP address which is called as NAT ( Network address translation ) To get [&#8230;]]]></description>
										<content:encoded><![CDATA[
<p>The devices behind a modem or an internet router will be assigned with private ip for communication within the internal network. When these devices needed to communicate to the outside world, the modem/router translate the private IP address to the public IP address which is called as NAT ( Network address translation )</p>



<p>To get information about our public IP, open any web browser and visit the page <a href="https://ifconfig.io/" target="_blank" rel="noreferrer noopener nofollow">https://ifconfig.io/</a>.</p>



<p>The same page also provide api to get the details.</p>



<h3 class="wp-block-heading">Public IP using PowerShell</h3>



<div class="wp-block-columns are-vertically-aligned-center is-layout-flex wp-container-core-columns-is-layout-9d6595d7 wp-block-columns-is-layout-flex">
<div class="wp-block-column is-vertically-aligned-center is-layout-flow wp-block-column-is-layout-flow" style="flex-basis:100%">
<div class="wp-block-group"><div class="wp-block-group__inner-container is-layout-flow wp-block-group-is-layout-flow">
<div class="wp-block-columns is-layout-flex wp-container-core-columns-is-layout-9d6595d7 wp-block-columns-is-layout-flex">
<div class="wp-block-column is-layout-flow wp-block-column-is-layout-flow">
<pre class="wp-block-code"><code lang="powershell" class="language-powershell">( Invoke-WebRequest -uri "https://ifconfig.io/ip" ).content </code></pre>
</div>
</div>
</div></div>
</div>
</div>



<p>Refer to <a href="https://ifconfig.io/" target="_blank" rel="noreferrer noopener">https://ifconfig.io/</a> to get more information about the API</p>



<div style="height:50px" aria-hidden="true" class="wp-block-spacer"></div>



<blockquote class="wp-block-quote is-style-default is-layout-flow wp-block-quote-is-layout-flow"><p>Hope you like this article and thank you for reading.</p></blockquote>
]]></content:encoded>
					
					<wfw:commentRss>https://tekcookie.com/get-your-public-ip-using-powershell/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">1916</post-id>	</item>
		<item>
		<title>Install drivers in Windows using PowerShell</title>
		<link>https://tekcookie.com/auto-install-drivers-using-powershell/</link>
					<comments>https://tekcookie.com/auto-install-drivers-using-powershell/#respond</comments>
		
		<dc:creator><![CDATA[jeffythampi]]></dc:creator>
		<pubDate>Wed, 16 Dec 2020 18:22:09 +0000</pubDate>
				<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[Windows]]></category>
		<category><![CDATA[Windows 10]]></category>
		<category><![CDATA[Windows Server 2016]]></category>
		<category><![CDATA[Install drivers with PowerShell]]></category>
		<guid isPermaLink="false">https://tekcookie.com/?p=1811</guid>

					<description><![CDATA[Installing drivers for windows is very time consuming when the driver package contain multiple devices/models files with all possible platform architecture(x86, x64, etc.). We can leverage the pnputil.exe tool to perform the installation fast and easy. Consider a scenario of a multiple drivers packed to an iso image. Below script will install all the required [&#8230;]]]></description>
										<content:encoded><![CDATA[
<p>Installing drivers for windows is very time consuming when the driver package contain multiple devices/models files with all possible platform architecture(x86, x64, etc.).</p>



<p>We can leverage the pnputil.exe tool to perform the installation fast and easy.</p>



<p>Consider a scenario of a multiple drivers packed to an iso image. Below script will install all the required drivers.</p>



<pre class="wp-block-code"><code lang="powershell" class="language-powershell line-numbers"># Mount the driver iso image
Mount-DiskImage D:\Driver\drivers-windows.iso

# Get the mount point/drive letter, considering that the above one is the only disk mounted
$isoMount = (Get-DiskImage -DevicePath \\.\CDROM0  | Get-Volume).DriveLetter

# Find the inf files and install
Get-ChildItem "$($isoMount):\" -Recurse -Include *.inf | ForEach-Object {
     $_.FullName
     pnputil /add-driver $_.FullName /install 
}</code></pre>



<p>Running the script would update all the drivers which are meant for your system hardware.</p>



<div style="height:70px" aria-hidden="true" class="wp-block-spacer"></div>



<blockquote class="wp-block-quote is-layout-flow wp-block-quote-is-layout-flow"><p>Hope you like this article and thank you for reading.</p></blockquote>
]]></content:encoded>
					
					<wfw:commentRss>https://tekcookie.com/auto-install-drivers-using-powershell/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">1811</post-id>	</item>
		<item>
		<title>Execute PowerShell Remotely with PSEXEC</title>
		<link>https://tekcookie.com/execute-powershell-remotely-with-psexec/</link>
					<comments>https://tekcookie.com/execute-powershell-remotely-with-psexec/#respond</comments>
		
		<dc:creator><![CDATA[jeffythampi]]></dc:creator>
		<pubDate>Mon, 19 Oct 2020 13:37:52 +0000</pubDate>
				<category><![CDATA[CMD]]></category>
		<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[connec to remote pc using psexec]]></category>
		<category><![CDATA[powershell-remoting]]></category>
		<category><![CDATA[psexec]]></category>
		<guid isPermaLink="false">https://tekcookie.com/?p=1742</guid>

					<description><![CDATA[PowerShell commands can be executed on a remote systems by using PowerShell-Remoting. By default, PowerShell remoting is disabled on clients operating systems. We can either enable PowerShell remoting by executing the command &#8220;Enable-PSRemoting -Force&#8221; under administrative context. This can be either done locally on each systems by executing the commands or remotely via a group [&#8230;]]]></description>
										<content:encoded><![CDATA[				<div class="wp-block-uagb-table-of-contents uagb-toc__align-left uagb-toc__columns-1  uagb-block-4f7ab2dc     "
					data-scroll= "1"
					data-offset= "30"
					style=""
				>
				<div class="uagb-toc__wrap">
						<div class="uagb-toc__title">
							Table Of Contents						</div>
																<div class="uagb-toc__list-wrap">
						<ol class="uagb-toc__list"><li class="uagb-toc__list"><a href="#interactive-powershell-prompt-with-psexec" class="uagb-toc-link__trigger">Interactive Powershell prompt with PSExec</a><li class="uagb-toc__list"><a href="#execute-multiple-powershell-commands-with-psexec" class="uagb-toc-link__trigger">Execute multiple Powershell commands with PSExec</a><li class="uagb-toc__list"><a href="#execute-multiple-powershell-commands-with-psexec" class="uagb-toc-link__trigger">Execute multiple Powershell commands with PSExec</a></ol>					</div>
									</div>
				</div>
			


<div style="height:50px" aria-hidden="true" class="wp-block-spacer"></div>



<p>PowerShell commands can be executed on a remote systems by using PowerShell-Remoting. By default, PowerShell remoting is disabled on clients operating systems.</p>



<p>We can either enable PowerShell remoting by executing the command &#8220;Enable-PSRemoting -Force&#8221; under administrative context. This can be either done locally on each systems by executing the commands or remotely via a group policy or through SCCM.</p>



<p>But if we have administrative access to a system, we can execute PowerShell commands remotely by means of PSEXEC.EXE (https://docs.microsoft.com/en-us/sysinternals/downloads/psexec)</p>



<p>PSEXEC shell does not work well (interactively) with PowerShell as it works with cmd commands.</p>



<div style="height:50px" aria-hidden="true" class="wp-block-spacer"></div>



<h2 class="wp-block-heading">Interactive Powershell prompt with PSExec </h2>



<p>In windows 10, the interactive part is much better.</p>



<p>Enabling PowerShell Remoting using PSEXEC</p>



<pre class="wp-block-code"><code lang="bash" class="language-bash">#cmd.exe in the administrative context
#navigate to the sysinternals tools folder or add the folder to the PATH
#executing the below command would take us to the powershell prompt of the remote system
psexec.exe \\&lt;computerName powershell.exe

#run the below command to enable PS Remoting or any commands as we wish
Enable-PSRemoting -Force</code></pre>



<div style="height:50px" aria-hidden="true" class="wp-block-spacer"></div>



<h2 class="wp-block-heading"> Execute multiple Powershell commands with PSExec </h2>



<p>So, rather than going with interactive way, we can also issue a single command to do the same task</p>



<pre class="wp-block-code"><code lang="bash" class="language-bash">#navigate to the sysinternals suite folder, to directly execute from the prompt, add the folder to the PATH
psexec.exe \\&lt;computerName&gt; powershell.exe -command "&amp; {Enable-PSRemoting -Force}"</code></pre>



<div style="height:50px" aria-hidden="true" class="wp-block-spacer"></div>



<h2 class="wp-block-heading">Execute multiple Powershell commands with PSExec</h2>



<p>We can also execute multiple commands as a single statement</p>



<pre class="wp-block-code"><code lang="bash" class="language-bash">#navigate to the sysinternals suite folder, to directly execute from the prompt, add the folder to the PATH
psexec.exe \\&lt;computerName&gt; powershell.exe -command "&amp; {Get-Process; Get-service; $num1 = 2; $num2 = 1; $num1 + $num2}"</code></pre>



<div style="height:30px" aria-hidden="true" class="wp-block-spacer"></div>



<p>Also, please have a look at my other post about PSEXEC</p>



<figure class="wp-block-embed is-type-wp-embed is-provider-tekcookie wp-block-embed-tekcookie"><div class="wp-block-embed__wrapper">
<blockquote class="wp-embedded-content" data-secret="3LKc5DQQbg"><a href="https://tekcookie.com/control-remote-windows-system-with-command-line-psexec/">Control remote windows system with command line &#8211; PSEXEC</a></blockquote><iframe class="wp-embedded-content" sandbox="allow-scripts" security="restricted"  title="&#8220;Control remote windows system with command line &#8211; PSEXEC&#8221; &#8212; TekCookie" src="https://tekcookie.com/control-remote-windows-system-with-command-line-psexec/embed/#?secret=3LKc5DQQbg" data-secret="3LKc5DQQbg" width="600" height="338" frameborder="0" marginwidth="0" marginheight="0" scrolling="no"></iframe>
</div></figure>



<div style="height:30px" aria-hidden="true" class="wp-block-spacer"></div>



<blockquote class="wp-block-quote is-layout-flow wp-block-quote-is-layout-flow"><p>Hope you liked this article and thank you for reading</p></blockquote>



<p>&nbsp;</p>
]]></content:encoded>
					
					<wfw:commentRss>https://tekcookie.com/execute-powershell-remotely-with-psexec/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">1742</post-id>	</item>
		<item>
		<title>Free Virtual Server for you in Oracle Cloud</title>
		<link>https://tekcookie.com/free-vm-in-oracle-cloud-infrastructure/</link>
					<comments>https://tekcookie.com/free-vm-in-oracle-cloud-infrastructure/#respond</comments>
		
		<dc:creator><![CDATA[jeffythampi]]></dc:creator>
		<pubDate>Sat, 05 Sep 2020 17:47:53 +0000</pubDate>
				<category><![CDATA[Oracle Cloud]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[OCI]]></category>
		<guid isPermaLink="false">https://tekcookie.com/?p=1635</guid>

					<description><![CDATA[Yeah, you can have virtual machine (VPS) in cloud for free. Oracle cloud infrastructure (OCI) was made generally available on October 20, 2016 with IaaS, PaaS and SaaS services. Signing up an account with OCI gives you 30 days free trial with USD 300 plus some always free services. Check out the details at https://www.oracle.com/in/cloud/free/ [&#8230;]]]></description>
										<content:encoded><![CDATA[
<p>Yeah, you can have virtual machine (VPS) in cloud for free.</p>



<p>Oracle cloud infrastructure (OCI) was made generally available on October 20, 2016 with IaaS, PaaS and SaaS services.</p>



<p>Signing up an account with OCI gives you 30 days free trial with USD 300 plus some always free services.</p>



<p>Check out the details at <a href="https://www.oracle.com/in/cloud/free/" target="_blank" rel="noreferrer noopener">https://www.oracle.com/in/cloud/free/</a></p>



<h3 class="wp-block-heading">The always free services include</h3>



<p><strong>Compute</strong></p>



<ul class="wp-block-list"><li>2 x Virtual Machines with 1/8 OCPU, 1 GB memory, 1 vNIC with 1 Public IP and 480Mbps Network bandwidth</li></ul>



<p><strong>Storage</strong></p>



<ul class="wp-block-list"><li>2 Block Volumes, 100 GB total.</li><li>10 GB Object Storage.</li><li>10 GB Archive Storage.</li></ul>



<p><strong>Other services</strong></p>



<ul class="wp-block-list"><li>Load Balancer: 1 instance, 10 Mbps bandwidth</li><li>Outbound Data Transfer: 10 TB per month.</li></ul>



<p>and more. Refer <a href="https://docs.cloud.oracle.com/en-us/iaas/Content/FreeTier/freetier.htm" target="_blank" rel="noopener">https://docs.cloud.oracle.com/en-us/iaas/Content/FreeTier/freetier.htm</a> for details.</p>



<p>During sign up, you will have to provide your credit card details, your card will be charged with $1 and will be refunded for verification.</p>



<p>After the free trial of 30 days, only the always free services will function. You need to upgrade the account for accessing the full features. Means you will not be charged unless you upgrade your account.</p>



<h3 class="wp-block-heading">Screenshot of a VM deployed in OCI</h3>



<figure class="wp-block-image size-large"><img data-recalc-dims="1" height="634" width="1024" decoding="async" src="https://i0.wp.com/tekcookie.com/wp-content/uploads/2020/09/OCI-VM-Summary.jpg?resize=1024%2C634&#038;ssl=1" alt="" class="wp-image-1647"/></figure>



<p>Ubuntu OS (16.04/18.04/20.04) minimal or other free eligible Linux OS on 1vCPU (1/8 oCPU), 1GB ram and 100GB disk space runs with good performance for FREE!!!. You can spin up a WordPress site or LAMP suite to host your website. After all you have 2 VM&#8217;s in the cloud.</p>



<p>Check out my post on how to install WordPress in Ubuntu.</p>



<figure class="wp-block-embed is-type-wp-embed is-provider-tekcookie wp-block-embed-tekcookie"><div class="wp-block-embed__wrapper">
<blockquote class="wp-embedded-content" data-secret="dxmCOJEPl9"><a href="https://tekcookie.com/install-wordpress-on-ubuntu/">Install WordPress on Ubuntu</a></blockquote><iframe class="wp-embedded-content" sandbox="allow-scripts" security="restricted"  title="&#8220;Install WordPress on Ubuntu&#8221; &#8212; TekCookie" src="https://tekcookie.com/install-wordpress-on-ubuntu/embed/#?secret=dxmCOJEPl9" data-secret="dxmCOJEPl9" width="600" height="338" frameborder="0" marginwidth="0" marginheight="0" scrolling="no"></iframe>
</div></figure>



<blockquote class="wp-block-quote is-layout-flow wp-block-quote-is-layout-flow"><p>Hope this is informative and thank you for reading.</p></blockquote>
]]></content:encoded>
					
					<wfw:commentRss>https://tekcookie.com/free-vm-in-oracle-cloud-infrastructure/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">1635</post-id>	</item>
	</channel>
</rss>
