chaitanya512-blog1
chaitanya512-blog1
Powershell
78 posts
Don't wanna be here? Send us removal request.
chaitanya512-blog1 · 4 years ago
Text
How to Copy files from Linux machine to Windows machine
How to Copy files from Linux machine to Windows machine
Hi All, Here is the SCP (secure copy) command line utility that we could use to copy the files from Linux machine (ubuntu) Regards, Chaitanya
Tumblr media
View On WordPress
0 notes
chaitanya512-blog1 · 4 years ago
Text
Linux How to Copy files from Linux machine to Windows machine
Linux How to Copy files from Linux machine to Windows machine
Hi All, Here is the SCP (secure copy) command line utility that we could use to copy the files from Linux machine (ubuntu) scp username "E:/Work/Devops/Ansible/" Regards, Chaitanya
View On WordPress
0 notes
chaitanya512-blog1 · 5 years ago
Text
Server Latency Check Script
Hi Everyone,
Below is the snippet you could use to check the latency from given server to another servers.
$sourceServer=’localhost’
$Destinationserverlist=’localhost’,’CHAY-WIN10′
$PacketCount=4 #default
$FinalServerLatencyReport=@()
foreach ($server in $Destinationserverlist)
{
$FinalServerLatencyReport+= Test-Connection -Source $sourceServer -ComputerName $server -Count $PacketCount| `
Measure…
View On WordPress
0 notes
chaitanya512-blog1 · 5 years ago
Text
Powershell Convert XLS file to CSV using Powershell
Hi All,
Below is the little snippet used to convert the Excel file to Csv format. Remember irrespective of how many sheets you had, after converting CSV file would have only one sheet
function ConvertFromExceltoCSV ( $Inputfilepath) {
$excel = New-Object -ComObject excel.application
$excel.visible = $false
Start-Sleep -Seconds 1
$fileOutputPath = $ Inputfilepath.Split(".")[0] + ".csv"
$reportOut…
View On WordPress
0 notes
chaitanya512-blog1 · 5 years ago
Text
Retrieve IIS Client mapping certificates
Retrieve IIS Client mapping certificates
Hi All,
Below is the snippet to retrieve the client mapping certificate from IIS .
$siteName = "WebSiteName"
# Get build folder path
$ScriptPath = $MyInvocation.MyCommand.Path
# Get build folder parent directory
$ScriptDir = Split-Path -Parent $ScriptPath
[string] $logdate =get-date -Format "yyyyMMddhhmm"
$OutputFolderPath = $ScriptDir + "\Certificates"
if(!(Test-Path $OutputFolderPath))
{
New-It…
View On WordPress
0 notes
chaitanya512-blog1 · 7 years ago
Text
Delete Duplicate Images in the Folder
Delete Duplicate Images in the Folder
HI Everyone,
Often we end up having same image multiple times in the same folder. It is very hard to remove. Below script will help you in easing this task.
$Folder = “C:\Users\chaitanya\pictures\Testing”
$Folderobj =get-childitem -Path $Folder -Recurse |where { ! $_.PSIsContainer }
$FolderobjCount = $Folderobj.Count
$ImageObjArr = @();
$Folderobj| ForEach-Object {
$FolderobjCount–;
$ImageHash =…
View On WordPress
0 notes
chaitanya512-blog1 · 7 years ago
Text
Compare 2 Image folders and copy the missing images
Compare 2 Image folders and copy the missing images
Hi Everyone,
  often , we do take photos and store it in our external drives  with same name or different name.
ex: we have inserted the  Camera memory card  in our system and copy it to our specific drive or to other external drive.  some time though images are same, file names might be different.  we can do the image comparison using powershell hash. below is the script for this.
  $Source=…
View On WordPress
0 notes
chaitanya512-blog1 · 8 years ago
Text
IIS Log file Location check Using PowerShell
IIS Log file Location check Using PowerShell
Hi All, if you want to check the IIS web site log location, You need to go to server and check the log file location. Below is the simple power shell script, you could use on multiple servers and get the web sites Log file Location and latest log file name. invoke-command -ComputerName Server1,Server2 -ScriptBlock { Import-Module WebAdministration $array =@() foreach($WebSite in $(get-website)) {…
View On WordPress
0 notes
chaitanya512-blog1 · 8 years ago
Text
Finding Files in a Folder having Carriage return
Finding Files in a Folder having Carriage return
Below is the simple powershell script to find Files in a Folder having Carriage return Get-ChildItem -Path ‘\\fileshare\folder’ | ForEach-Object { $contents = [System.IO.File]::ReadAllText($_.FullName) if ($contents -cmatch ‘\r\n’) { $_.BaseName } } Happy scripting. Regards, Chaitanya
View On WordPress
0 notes
chaitanya512-blog1 · 8 years ago
Text
Delete Unwanted Host Instances on the specified BizTalk Server
Delete Unwanted Host Instances on the specified BizTalk Server
[ARRAY]$hostInstanceObj = get-wmiobject MSBTS_HostInstance -namespace ‘root\MicrosoftBizTalkServer’ -Filter ‘RunningServer="Server1"’ [ARRAY]$HostInstanceObj1 = "Process_Host2","Archive_Host" # Provide the Unwanted Host Instances that you want to remove on the Server1 $hostInstances = $hostInstanceObj | ?{$HostInstanceObj1 -contains $_.hostname} [ARRAY]$HostInfo = get-wmiobject MSBTS_ServerHost…
View On WordPress
0 notes
chaitanya512-blog1 · 8 years ago
Text
PowerShell Script to Start Only Specified Host instances and Stop remaining Host Instances in BizTalk server
PowerShell Script to Start Only Specified Host instances and Stop remaining Host Instances in BizTalk server
Hi All, Some of the times, we are in a situation to start only specified host instances in your biztalk group and stop the remaining . in that case, you could use this script to achieve that. [ARRAY]$hostInstanceObj = get-wmiobject MSBTS_HostInstance -namespace ‘root\MicrosoftBizTalkServer’ [ARRAY]$HostInstanceObj1 = "BizTalkServerApplication","TrackingHost" $StophostInstances = $hostInstanceObj…
View On WordPress
0 notes
chaitanya512-blog1 · 8 years ago
Text
Want Copy Files From Sql Result as you want
Want Copy Files From Sql Result as you want
Hi All, Often we try to copy the files from sql server tables and we end up renaming the copied file names manually. Here is simple sql server statement, where it pull the message archive location and name of the file will be with some GUID and you want to name with PO number column , use this simple select statement select ‘copy ‘+MessageArchiveLocation +’,’+’"’+PONumber+’.xml’+’"’ from…
View On WordPress
0 notes
chaitanya512-blog1 · 8 years ago
Text
Delete GUID named files in folders
Delete GUID named files in folders
Hi All, Want to delete the GUID named files in your folders? Here is the simple script that takes the regex for GUID and compares the file name and remove it. get-childitem |? {$_.basename -match("^(\{){0,1}[0-9a-fA-F]{8}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{12}(\}){0,1}$")} |Remove-Item if you want to Include subfolders too, use the recurse option like below get-childitem…
View On WordPress
0 notes
chaitanya512-blog1 · 8 years ago
Text
check .Net frame work Version for the DLLs
check .Net frame work Version for the DLLs
Hi All, If you got bunch of DLLs and want to check the .net version for those, this is simple script you can use to find out the version. # check .net frame work for the DLLs $filepath=’D:\Builds\\AutomatedDeployment\Deployment\Add-PreDlls’ $files=Get-ChildItem -Path $filepath -Recurse -filter *.dll foreach($file in $files) { $version =…
View On WordPress
0 notes
chaitanya512-blog1 · 8 years ago
Text
Configure schedule task that runs every 5 minutes for N years
Configure schedule task that runs every 5 minutes for N years
Hi all, Here is the sample PowerShell script to configure schedule task that runs every 5 minutes for 3 years. You can change the years , why did I not mentioned infinite time is because of some limitation that I had explained in the other article. https://sqlblogging.com/2017/08/16/fixethe-task-xml-contains-a-value-which-is-incorrectly-formatted-or-out-of-range-durationp99999999dt23h59m59s/…
View On WordPress
1 note · View note
chaitanya512-blog1 · 8 years ago
Text
Convert datetime::Now value to specific format for comparison-Power Shell
Hi All, How to convert datetime value to specific format for comparison For get-date cmdlet, we have property called format , using that I can convert the date into specific format. But for [datetime]::Now as it is c# static class, for that to convert the date time into specific format, you could use the toString method like below $date = get-date -Format "yyyyMMddhhmm" – input value…
View On WordPress
0 notes
chaitanya512-blog1 · 8 years ago
Text
Block Chain Technology - the Next Internet
Block Chain Technology – the Next Internet
As you are hearing now a days about lot about bit coin and its value reaching all-time high, but Bit coin actually works using block chain model. Most of them predicting this is the new internet and also it is a new technology revolution. This is the TedEx video , you could find the information on Block chain in a simplified way. I could not agree more on that.…
View On WordPress
0 notes