Showing posts with label Command. Show all posts
Showing posts with label Command. Show all posts

Thursday, 15 September 2016

Set-DnsClientServerAddress: Powershell command to set the DNS Server

Set-DnsClientServerAddress: Powershell command to set the DNS Server


  • You need to configure the DNS Server Ip adress of the Server.
  • This will help name resolution to happen correctly.
  • To configure DNS Server Name for your network Card use "Set-DnsClientServerAddress"

Set-DnsClientServerAddress -InterfaceAlias "AdminNet" -ServerAddresses 192.168.10.2

PowerShell command to set Ipv6 IP Address


PowerShell command to step Ipv6 IP Address

  • Powershell is the most effective way to set the Ip Adress to all servers.
  • You use the New-NetIPAddress with -AddressFamily IPv6
  • This will set the Ipaddress to V6.
  • You should also mention the interface address

New-NetIPAddress -AddressFamily IPv6 -InterfaceAlias "AdminNet" `
-IPAddress 2001:db8:0:10::2 -PrefixLength 64 -DefaultGateway 2001:db8:0:10::1

New-NetIPAddress: PowerShell command to configure Static Ip Address

PowerShell command to configure Static Ip Address

  • Many times we have to configure Ipadress
  • Its usually done for servers where static ip address are given.
  • To set Static Ip adress you need to know the Network Interface for which you want to set the IP
  • To configure you use the command "New-NetIPAddress"
New-NetIPAddress -AddressFamily IPv4 -InterfaceAlias "AdminNet" `
-IPAddress 192.168.10.2 -PrefixLength 24 -DefaultGateway 192.168.10.1

  • -AddressFamily tells whether its IPV4 or IPV6
  • -InterfaceAlias tells the Name of the network.
  • -IPAddress specify the ip adress you want to configure.
  • -PrefixLength speciy the Subnet length.
  • -DefaultGateway specify the Gateway IP.

Get-NetAdapter: PowerShell Command to find Network Adapater Alias name and Index Number

PowerShell Command to find Network Adapater Alias name and Index Number


  • If you have to do changes to your Network Adapter then you need to know the Alias Name and Index Number
  • You can find those easily in PowerShell
  • The Command is "Get-NetAdapter"
  • You can see the "Name" which is Alias and ifIndex which is the "Index Number"

Wednesday, 14 September 2016

Install-ADDSDomainController: PowerShell Command to Promote a Server to Domain Controller

PowerShell Command to Promote a Server to Domain Controller




Install-ADDSDomainController -SkipPreChecks -NoGlobalCatalog:$false -CreateDnsDelegation:$false `
-CriticalReplicationOnly:$false -DatabasePath "C:\Windows\NTDS" -DomainName "Contoso.com" `
-InstallDns:$true -LogPath "C:\Windows\NTDS" NoRebootOnCompletion:$false -SiteName `
"Default-First-Site-Name" `-SysvolPath "C:\Windows\SYSVOL" -Force:$true


  • Install-ADDSDomainController will promote the Server to Domain Controller.
  • -SkipPreChecks will skip the prechecks and will procced with the install
  •  -NoGlobalCatalog:$false Will not install Global Catalog Component on this server.
  • -CreateDnsDelegation:$false Will not create DNS Delegation on this server
  • -DatabasePath tell where should be the NTDS Folder Location
  • -DomainName tell your Domain Name
  • -InstallDns:$true Installs DNS Component on the server
  • -LogPath tells the LogPath Location.
  •  NoRebootOnCompletion:$false Will not reboot the server after install.If you want to reboot make it $true
  • -SiteName Enter the AD Site name where server has to be installed
  • -SysvolPath Location of the Sysvol folder

Thursday, 30 June 2016

Powershell Command to find version of OS


Powershell Command to find version of OS



  • To find which version of Windows you are running, enter the following commands in the Command Prompt or Powershell:


wmic os get caption

wmic os get osarchitecture

Saturday, 25 June 2016

Powershell Get-Help Command Usages and uses- Powershell Basics

Powershell Get-Help Command Usages and uses


Get-Help:

  • The Help Command in PowerShell cmdlet . You can use this command to get help with any other command. For example, if you want to know how the Get-Service command works, you can type:

Get-Help -Name Get-Service
and Windows will display the full command syntax.

  • You can also use Get-Help with individual nouns and verbs. For example, to find out all the commands you can use with the Get verb, type:

Get-Help -Name Get-*

Sunday, 24 April 2016

ADD-Content: Powershell command to add content to text file.

ADD-Content: Powershell command to add content to text file.

  • There are times when you want to ADD a content to text file after taking some actions in powershell
  • ADD-Content is the Command to use to add.
ADD-CONTENT C:\TEMP\test.txt "This is the Begning"

  • One more scenario is that you have list of text files and want to add a common thing to all then you can use the WildCards like below
$NTime=Get-Date
ADD-CONTENT C:\Temp\*.txt $Ntime

  • This will add the current date and time to all the text files in temp folder.

Saturday, 16 April 2016

Test-Connection:Powershell alternate command to Ping is Test-Connection

Powershell alternate command to Ping is Test-Connection



  • Ping is the first network utility that we use to test the connection
  • In Powershell Ping is called Test-Connection
  • It provides the same functionality of Ping

Tuesday, 12 April 2016

ADD-ADGroupMember:Powershell Command to ADD users to AD group

Powershell Command to ADD users to AD group

  • Today we will see how to add Active Directory users to Active directory group.
  • To add users to AD group use "ADD-ADGroupMember" command.
Ex: To add 2 users Mark and Kathy to the Security group "WebAdmins" Group

ADD-ADGroupMember WebAdmins Mark,Kathy

Tuesday, 5 April 2016

Easy way to access your network cards and configure them - ncpa.cpl

Easy way to access your network cards and configure them -ncpa.cpl

  • Opening the network card is a bit of challenge in the computer. It usually takes to network page from where you have to again click on another tab to go to your network card. I was always feeling if there is easy way to do it and the yes there is
  • Click on Start --> in search box type "ncpa.cpl"
  • This will directly open the Network card page.
  • I hope it makes your life easier like mine :)

Tuesday, 29 March 2016

Connect-VIserver:Powershell Command to Add VMHost to Vcenter Server

Powershell Command to Add VMHost to Vcenter Server

  • Powershell has been so much part of life that almost all products provide powershell cmdlets to there products
  • one such popular product is VmWare.
  • Today we will see how to Add a Host to the Vcenter Server.
  • For this first you need to download the vSphere PowerCLI 6.0 and install it.
  • You can download it here --> Click here
  • To Add a Host use the below Command
$VIServer = Connect-VIserver -server <IP of your vcenter server>

Add-VMHost -Server $VIServer -Name VMHost1 -Location <Datacenter location> -User <Vmadmin user> -Password <VMAdmin Password>

Tuesday, 1 September 2015

PowerShell Command to get Specific Alert in SCOM 2012 R2 and SCOM 2016

PowerShell Command to get Specific Alert in SCOM 2012 R2 and SCOM 2016


  • Powershell Command to get only Specific alert with Specific Name is something we are asked frequently
  • Use the Below Command to get it done
  • GET-SCOMAlert Where {$_.Name --eq "Alert You want to get"}

Thursday, 6 August 2015

SCOM 2012 R2 Powershell Command to check if Server is Physical or Virtual

SCOM Powershell Command to check if Server is Physical or Virtual


  • Get-SCOMaccesLicense where DEVICE_ID "Computername"
  • This will give you information whether the server is Virtual or Physical.Its agent managed or Agentless Managed.

Tuesday, 28 July 2015

SCOM 2012 R2 Data warehouse command to get information on Various Tables and how much space they are talking

SCOM 2012 R2 Data warehouse command to get information on Various Tables and how much space they are talking


  • SCOM Data warehouse is the one where we store all data for longtime.
  • Usually this will be in terabytes of data and will fill very fast if not confiureged properly
  • Most offten you can see that the Datawarehouse if Full or going to be full and you want to find out what is the configuration and which Table is taking the most data
  • Microsoft has pushed a command line tool in SCOM 2012 R2 called dwdatarp.exe
  •  To get the list of tables using more space and configuration use the below command

dwdatarp.exe -s SQLServer\DatabaseName -d OperationsManagerDW > c:\dwoutput.txt


  • This will give you the output with Space used and the How many days of data is stored.

Monday, 27 July 2015

Command to Get List of Patches installed on Windows 2008 R2 and Windows 2012

Command to Get List of Patches installed on Windows 2008 R2 and Windows 2012


  • Manytime we get request from application owners who request for list of patches instaled and on what date
  • You can use the below command to get the list of Patches from the server. This will Create a html file called hotfix.html in your C: drive.
  • wmic qfe list brief /format:htable > "c:\hotfix.html"

Sunday, 21 June 2015

Powershell Command to create Folder

Command to create Folder from Powershell


  • Powershell is very powerful tool.You can create a Folder from within Powershell using "MD" command
Below command creates a folder called test4 from within Powershell.

md "c:\test4"

Powershell Command to open any file

Powershell Command to open any file


  • Many people think that you can only open txt or html file from Powershell. Thats not true.
  • You can open any File type using Invoke-Item Powershell Command

In the below example we open JPG file from within powershell

INVOKE-ITEM "C:\test.jpg"

Tuesday, 9 June 2015

Powershell Command to extract sealed Management pack from SCOM 2012 R2

Powershell Command to extract sealed Management pack from SCOM 2012 R2:


  • Many times we face situation where we want to export the sealed MP's
  • But guess what the MP was earlier imported by 1 of your collegue and he is no longer in the organization
  • Then you don't know where the MP's are and you can;t export sealed MP's in SCOM .
  • But there ise Command Shell (SCOM version of Powershell to help you)
  • Get-SCOMManagementpack "*veeam*" | Export-SCOMManagementpack -Path "c:\export" 
  • This command will get you the sealed Management pack in xml form which is the same.
  • This xml version will also help you customize the vendor provided MP.

Monday, 25 May 2015

PowerShell Command to repair SCOM agent

PowerShell Command to repair SCOM agent


  • There are many different ways to repair a SCOM agent.
  • Most preferred way is to Use SCOM console Right Click and select repair option.
  • Another way is to Use Command Shell command
  • "REPAIR-SCOMAGENT" is the command you have to use to repair the SCOM agent.
  • By default it uses the SCOM action account to repair the agent.So make sure it have sufficient rights on the server