Need help in powershell

Đã hoàn thành Đã đăng vào 3 năm trước Thanh toán khi bàn giao
Đã hoàn thành Thanh toán khi bàn giao

I need help in powershell commands. the person should have deep knowledge of powershell. The project is not that long. I want the below command to search from list of servere from a file [login to view URL] and see if server exits and if it does not this command should send me email. The below command is not working and your job is to make it working

$usernamesend="**@gmail.**"

$From = "**@gmail.**"

$To = "**2@gmail.**"

$Cc = " "

$Subject = "$Server is not working"

$Body = "Insert body text here"

$SMTPServer = "[login to view URL]"

$SMTPPort = "587"

$secpasswd = ConvertTo-SecureString “emailpassword” -AsPlainText -Force

$cred = new-object [login to view URL] ($usernamesend,$secpasswd)

Function Test-Server {

[CmdletBinding()]

# Parameters used in this function

param

(

[Parameter(Position=0, Mandatory = $true, HelpMessage="Provide server names", ValueFromPipeline = $false)]

$ComputerName

)

$Array = @()

ForEach($Server in $ComputerName)

{

$Server = $[login to view URL]()

$SMB = $null

$Object = $null

$Status = $null

$SMB = Test-Path "\\$server\c$"

If($SMB -eq "True")

{

$Status = "True"

$Object = New-Object PSObject -Property ([ordered]@{

Server = $Server

"Is Online?" = $Status

})

$Array += $Object

}

Else

{

$Status = "False"

$Object = New-Object PSObject -Property ([ordered]@{

Server = $Server

"Is Online?" = $Status

Send-MailMessage -From $From -to $To -Cc $Cc -Subject $Subject -Body $Body -SmtpServer $SMTPServer -port $SMTPPort -UseSsl -Credential $Cred

})

$Array += $Object

}

}

If($Array)

{

return $Array

}

}

Test-Server -ComputerName (Get-Content "C:\temp\[login to view URL]")

Shell Script Lập trình C# Powershell Kiến trúc phần mềm DNS

ID dự án: #27842199

Về dự án

5 đề xuất Dự án từ xa 3 năm trước đang mở

Được trao cho:

kanwaljeetk56

Hi, I have already designed this kind of monitoring script to check after every interval if computer is not pinging then it will send an email alert to the configured email id. you can input all your windows servers Thêm

$30 CAD trong 1 ngày
(11 Đánh Giá)
3.4

5 freelancer chào giá trung bình$26 cho công việc này

MIGHTX

Hi, I work doing automation with powershell. I would like to participate in your project. please send me to chat to share details. regards

$30 CAD trong 2 ngày
(9 Nhận xét)
3.6
Andrej126

Hi, Now,I understand what you want. I have source code to send email. So,I can resolve your problem quickly I am available full time for your project. Please send the message to discuss the more details. I will be wa Thêm

$50 CAD trong 1 ngày
(4 Nhận xét)
3.0
Junaid3100

I am full stack developer, had worked on php larvel, cake php, Javascript and Django. I have successful history in web development and web designing. I have developed multiple application and UI/UX and many logos and g Thêm

$10 CAD trong 1 ngày
(0 Nhận xét)
0.0
AbsarHN

I am a IT Infrastructure Service Delivery specialist , please check my profile for further details. Brief skill i have: KILLS AND COMPETENCIES TECHNICAL • IT Service Management • Service Level Management • Change and C Thêm

$10 CAD trong 2 ngày
(0 Nhận xét)
0.0