Need help in powershell
$10-30 CAD
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]")
ID dự án: #27842199
Về dự án
Được trao cho:
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
5 freelancer chào giá trung bình$26 cho công việc này
Hi, I work doing automation with powershell. I would like to participate in your project. please send me to chat to share details. regards
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