Powershell Scripts

PowerShell Script using Webclient to download files from URL with basic authentication

The below PowerShell script will use WebClient to download files from a URL that is requesting basic authentication. #!powershell # Setup Key Values ################################### $URL="http://yourserver//filetodownload.exe" $DOWNLOADTARGETPATH= "C:\filetodownload.exe" $USER_TO_ACCESS_DOWNLOAD = "YourUserName" $USER_PW = "YourUserPassword" # Force TLS 1.2 ################################### [System.Net.ServicePointManager]::ServerCertificateValidationCallback = {$true} [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 # Download the file with authentication using webclient [...]

2024-09-04T15:18:26-04:00September 4th, 2024|Microsoft, Powershell Scripts|Comments Off on PowerShell Script using Webclient to download files from URL with basic authentication

PowerShell Script using Invoke-WebRequest to download files from URL with basic authentication

The below PowerShell script will use Invoke-WebRequest to download files from a URL that is requesting basic authentication. #!powershell # Setup Key Values ################################### $URL="http://yourserver//filetodownload.exe" $DOWNLOADTARGETPATH= "C:\filetodownload.exe" $USER_TO_ACCESS_DOWNLOAD = "YourUserName" $USER_PW = "YourUserPassword" # Forece TLS 1.2 ################################### [System.Net.ServicePointManager]::ServerCertificateValidationCallback = {$true} [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 # Download the file with authentication using Invoke-WebRequest [...]

2024-06-12T19:29:19-04:00June 12th, 2024|Microsoft, Powershell Scripts|Comments Off on PowerShell Script using Invoke-WebRequest to download files from URL with basic authentication

PowerShell Script to change the password of the local administrator account

The below PowerShell script will Allow you to change the password of the local administrator account. #!powershell # Setup Key Values ################################### $newpassword = "YourNewPassword" $ErrorActionPreference = "Stop" $hostname = "$env:computername" # Create computer object $computer = [ADSI]("WinNT://$hostname,computer") # Get local users list $userList = $computer.psbase.Children | Where-Object { $_.psbase.schemaclassname -eq 'user' [...]

2024-06-12T19:27:33-04:00June 7th, 2024|Microsoft, Powershell Scripts|Comments Off on PowerShell Script to change the password of the local administrator account

PowerShell Script to download and unzip files

The below PowerShell script will demonstrate how to download and unzip files to specific directory. #!powershell # Setup Key Values ################################### $URL="http://yourserver//yourzipfilename.zip" $downloadtargetpath= "C:\temp\yourzipfilename.zip" $unziptargetpath= "C:\temp" # Forece TLS 1.2 ################################### [System.Net.ServicePointManager]::ServerCertificateValidationCallback = {$true} [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 # Download the script to C:\temp Directory ########################################### write-host " " write-host "Download the zip [...]

2023-04-25T02:04:23-04:00April 25th, 2023|Microsoft, Powershell Scripts|Comments Off on PowerShell Script to download and unzip files

PowerShell Script to Add IP to Local Host File

The below PowerShell script will Add any IP you like to the Local Windows Host File for name resolving . #!powershell # Setup Key Values ################################### $ServerName = "ad01.knowledgeascent.com' $IPofServerName = "10.100.200.50" $file = "C:\Windows\System32\drivers\etc\hosts" $hostname = $env:computername # Adding the IP to Local Host File ##################################### function add-host([string]$filename, [string]$ip, [string]$hostname) { [...]

2022-06-09T12:40:30-04:00June 9th, 2022|Microsoft, Powershell Scripts|Comments Off on PowerShell Script to Add IP to Local Host File

PowerShell Script to install and configure SNMP

The below PowerShell script will check if SNMP is installed, if it is not installed it will install the service and configure it. #!powershell # Setup Key Values ################################### ## Security Tab $managers = @("localhost","mgt1.knowledgeascent.com") $ReadOnlyCommunities = @("public") $ReadWriteCommunities = @("publicrw") ## Agent Tab $sysContact = "[email protected]" $sysLocation = "KA Data Center" [...]

2021-11-26T01:59:28-05:00November 26th, 2021|Microsoft, Powershell Scripts|Comments Off on PowerShell Script to install and configure SNMP

PowerShell Script to rename local Guest account

The below PowerShell script will demonstrate how to rename local guest account. #!powershell# Setup Key Values###################################$computername = "$env:computername"# Rename Local Guest Account  ###################################$ErrorActionPreference = "Stop"# Create computer object$computer = [ADSI]("WinNT://$computerName,computer")# Get local users list$userList = $computer.psbase.Children | Where-Object { $_.psbase.schemaclassname -eq 'user' }foreach ($user in $userList)  {   # Create a user object in order to [...]

2018-05-04T01:16:51-04:00May 4th, 2018|Microsoft, Powershell Scripts|Comments Off on PowerShell Script to rename local Guest account

PowerShell Script to rename local Administrator account

The below PowerShell script will demonstrate how to rename local administrator account. #!powershell# Setup Key Values###################################$computername = "$env:computername" # Rename Local Administrator Account  ###################################$ErrorActionPreference = "Stop"# Create computer object$computer = [ADSI]("WinNT://$computerName,computer")# Get local users list$userList = $computer.psbase.Children | Where-Object { $_.psbase.schemaclassname -eq 'user' }foreach ($user in $userList)  {   # Create a user object in order to [...]

2018-05-04T01:15:48-04:00May 4th, 2018|Microsoft, Powershell Scripts|Comments Off on PowerShell Script to rename local Administrator account

PowerShell Script to disable windows firewall or add rules to the firewall

The below PowerShell script will disable local host windows firewall. #!powershell# Disable Firewall#########################write-host " " write-host "Disabling firewall" -ForegroundColor Yellowwrite-host " "Set-NetFirewallProfile -Profile * -Enabled False If you are looking to only opening some ports, below is the script that you should consider. #!powershell# Adding Rules in the Windows Firewall#######################################write-host " " write-host [...]

2017-12-25T15:09:14-05:00December 24th, 2017|Microsoft, Powershell Scripts|Comments Off on PowerShell Script to disable windows firewall or add rules to the firewall

PowerShell Script to change Windows Host timezone

The below PowerShell script will help change the Windows host time zone to Eastern Standard Time. #!powershell# Change the Timezone to EST###################################write-host " " write-host "Changing Windows Host time zone to Eastern Standard Time" -ForegroundColor Yellowwrite-host " "Set-TimeZone -Name "Eastern Standard Time"

2017-12-25T15:08:34-05:00December 8th, 2017|Microsoft, Powershell Scripts|Comments Off on PowerShell Script to change Windows Host timezone

About me

I have more than 15 years hands-on experience in the IT field. The majority of my work is in networking, operating systems and applications and storage. I carry industry certifications in Redhat, Microsoft, EMC, VMWare, VCE and ITIL.

I find it hard to find procedures or documents on how to implement specific technology and this is how the decision to create a place to share my knowledge and ideas for anyone interested in the same subject.

If you have the same vision and you are interested to publish on this website please contact me and I will create an account for you.

Certifications:
RHCSA

Certifications:
MCSE Security
MCSA Massaging

Certifications:
EMCIE- Isilon
EMCTA- Isilon
EMCIE- VNX

Certifications:
VCP-DCV

Certifications:
VCE-CIA

Certifications:
TITL

This site is targeting Solution Architects, Implementation Engineers and Systems Administrators. It is not targeting sales or intending to promote any specific technology or vendor.

The focus is on hands-on work, technical documentations and architecting solutions.

The site reflects my knowledge and opinions, I do recommend that you test what you learn in the lab environment before implementing it in production.

If you have a doubt call technical support, I do not assume any liability for any errors or omissions in those articles, I also make no representations as to the accuracy or completeness of any information on this site or found by following any link on this site

Content published here is tested in my own lab and is not reviewed or approved by any vendor.

If you have any issues with your system I highly recommend you contact the technical support of the vendor.

Disclaimer

Knowledge Ascent (KA) makes information available on its web site to enhance public knowledge and promote a better understanding of the IT environment. KA attempts to provide accurate, complete, and timely information. KA, however, cannot guarantee the quality, content, accuracy, or completeness of the information, text, graphics, links, and other items contained on its web pages because the material comes from a variety of sources, collected and maintained for different purposes. KA also retains the right to change any content on its web site without prior notice.

Information provided on the KA web site should not be used as a substitute for IT or other professional advice. KA assumes no liability for any damages or loss of any kind that might arise from the use of, misuse of, or the inability to use the KA web site and/or the materials contained on the web site. KA also assumes no liability for improper or incorrect use of materials or information contained on its web site. All materials that appear on the KA web site are distributed and transmitted "as is," without warranties of any kind, either express or implied, and subject to the terms and conditions stated in this disclaimer.

Go to Top