Category Archives: PowerShell

Finding Time zone of server


If anyone want to know time zone of server, simply use the below command in PowerShell console.

tzutil /g

if you want to check it on remote servers, use invoke-command

invoke-command -scriptblock {tzutil /g} -ComputerName comp1,comp2

Regards,

Chaitanya

PowerShell script to check multiple strings combination in the file


Often I receive requests to check the multiple string combinations in the given set of files.It’s really a pain to do all manual check. Here the small PowerShell script to accomplish that.

Requirement:

Request to check the 2 strings in a file with the combination:

Ex: in the file I need to find a string ‘BOB’ and also I need to find another string ‘bought Car’

if ((Get-Content -path filelocation | Select-String -pattern $String1 -Quiet) -and (Get-Content -path filelocation | Select-String -SimpleMatch $String2 -Quiet))

{

‘combination exists’

}

else

{

‘combination not exists’

}

In the next post, I will post about searching multiple strings in the file shares and copy those files in the destination location.

Regards,

Chaitanya

Create your own website, free on WordPress.com.Create your own website.
Start free