Number of windows servers reboot time through PowerShell scripting

This code is using for one server ----Get-WmiObject win32_operatingsystem | select csname, @{LABEL='LastBootUpTime';EXPRESSION={$_.ConverttoDateTime($_.lastbootuptime)}}
How to get more than one server reboot time through PowerShell scripting? 
cheers
uday

#Method 1#When you have few servers which you can quicly type
'localhost' , 'localhost' | %{Get-WmiObject win32_operatingsystem |
select csname, @{LABEL='LastBootUpTime';EXPRESSION={$_.ConverttoDateTime($_.lastbootuptime)}}}
#Mehod 2#When you have huge list you can make csv with header and use $_.headername
Import-CSV C:\Temp\Serverlist.csv | %{Get-WmiObject win32_operatingsystem -ComputerName $_.ServerName |
select csname, @{LABEL='LastBootUpTime';EXPRESSION={$_.ConverttoDateTime($_.lastbootuptime)}}}
#Method 3
#Same as method 2 but using text file
$pc = Get-Content C:\Temp\Serverlist.txt
foreach($server in $pc){
Get-WmiObject win32_operatingsystem -ComputerName $server |
select csname, @{LABEL='LastBootUpTime';EXPRESSION={$_.ConverttoDateTime($_.lastbootuptime)}}
Regards Chen V [MCTS SharePoint 2010]

Similar Messages

  • How to Turn On/Off Airplane mode in windows through powershell script

    I want to turn on and off Airplane mode through powershell script, any way for this?
    I know that there are some exe files that can be used, but still I want to do this from powershell script.

    Hi,
    According to your description, I would like to share the link with you:
    Airplane Mode On or Off Shortcuts - Create in Windows 8
    http://www.eightforums.com/tutorials/24541-airplane-mode-off-shortcuts-create-windows-8-a.html
    If you want to the detail of the script, I suggest to post the question on Script Center forum for further help.
    Script Center forum:
    http://social.technet.microsoft.com/Forums/scriptcenter/en-US/home
    Note: Microsoft provides third-party contact information to help you find technical support. This contact information may change without notice. Microsoft does not guarantee the accuracy of this third-party contact information.
    Regards,
    Kelvin_Hsu
    TechNet Community Support

  • How to Read the "text file and csv file" through powershell Scripts

    Hi All
    i need to add a multiple users in a particular Group through powershell Script how to read the text and CSV files in powershell
    am completly new to Powershell scripts any one pls respond ASAP.with step by step process pls
    Regards:
    Rajeshreddy.k

    Hi Rajeshreddy.k,
    To add multiple users to one group, I wouldn't use a .csv file since the only value you need from a list is the users to be added.
    To start create a list of users that should be added to the group, import this list in a variable called $users, the group distinguishedName in a variable called $Group and simply call the ActiveDirectory cmdlet Add-GroupMember.
    $Users = Get-Content -Path 'C:\ListOfUsernames.txt'
    $Group = 'CN=MyGroup,OU=MyOrg,DC=domain,DC=lcl'
    Add-ADGroupMember -Identity $Group -Members $Users

  • Enable document management for entities through PowerShell script (Dynamic CRM 2013 on premises)

    Hello,
    Can anybody let me know if it is possible to enable document management for entities through PowerShell script for Dynamic CRM 2013 on premises.
    I want power shall script where user will give the entity (Accounts, Contacts etc.)   for the CRM.
    The script should enable the document management for the entity.
    Thank you for your support.

    Hi Jeff,
    Any updates? If you have any other questions, please feel free to let me know.
    A little clarification to the script:
    function _ErrObject{
    Param($name,
    $errStatus
    If(!$err){
    Write-Host "error detected"
    $script:err = $True
    $ErrObject = New-Object -TypeName PSObject
    $Errobject | Add-Member -Name 'Name' -MemberType Noteproperty -Value $Name
    $Errobject | Add-Member -Name 'Comment' -MemberType Noteproperty -Value $errStatus
    $script:ErrOutput += $ErrObject
    $errOutput = @()
    _ErrObject Name, "Missing External Email Address"
    $errOutput
    _ErrObject Name "Missing External Email Address"
    $errOutput
    If you have any feedback on our support, please click here.
    Best Regards,
    Anna Wang
    TechNet Community Support

  • Error while adding the app in the sharepoint(2013) page through powershell script

    Hi,
        I have created one powershell script to uninstall and install the sharepoint 2013 apps. The code is working fine, but after adding the app in the page I am getting the error "
    Internet Explorer can not display the webpage".
    If I am deploying the app through Visual Studio, its getting deployed successfully and I am getting an option to trust the app.And I am able to add it in the page. But this permission is not coming when I am installing the app using power shell.
    Please let me know whether to do any modifications to the power shell script.
    Thanks.
    Pradeep

    Hi,
       We are using sharepoint hosted app.
    Below is the script to uninstall and install the app.
    cls
    Add-PSSnapin Microsoft.SharePoint.PowerShell –ea SilentlyContinue
    # uninstall the app
    Write-Host "uninstallation of app"
    $InstalledSPApps = Get-SPAppInstance -Web "http://mySharepointSite.xyz.com"
    $appToUninstall = $InstalledSPApps | where {$_.Title -eq 'myCustomSharepointApp'}
    if ($appToUninstall -ne $null)
        Uninstall-SPAppInstance -Identity $appToUninstall ;
        Write-Host "uninstalled successfully"
    # Import-SPAppPackage
    Write-Host "Import the app"
    pause
    $sourceApp = ([microsoft.sharepoint.administration.spappsource]::RemoteObjectModel);
    $myspapp = Import-SPAppPackage -Path "D:\SharePoint 2013\AppsSolution\myCustomSharepointApp.app" -Site "http://mySharepointSite.xyz.com" -Source $sourceApp ;
    Write-Host "Enter to install the app"
    pause
    $app = Install-SPApp -Web "http://mySharepointSite.xyz.com" -Identity $myspapp;
    $AppName = $app.Title;
    Write-Host "app '$AppName' registered"
    pause
    $appInstance = Get-SPAppInstance -Web "http://mySharepointSite.xyz.com" | where-object {$_.Title -eq $AppName};
    $counter = 1;
    $maximum = 150;
    $sleeptime = 2;
    Write-Host -ForegroundColor White "Please wait..." -NoNewline;
    pause
    while (($appInstance.Status -eq ([Microsoft.SharePoint.Administration.SPAppInstanceStatus]::Installing)) -and ($counter -lt $maximum))
        Write-Host "." -NoNewline;
        sleep $sleeptime;
        $counter++;
        $appInstance = Get-SPAppInstance -Web "http://mySharepointSite.xyz.com" | where-object {$_.Title -eq $AppName}
    pause
    if ($appInstance.Status -eq [Microsoft.SharePoint.Administration.SPAppInstanceStatus]::Installed)
        Write-Host "The App was successfully installed.";
        $appUrl = $appInstance.AppWebFullUrl;
        Write-Host -ForegroundColor White "The App is available at '$appUrl'.";

  • Can I change default settings for Windows Serial Latency times through LabVIEW

    I have a wireless data collection device my company makes that I am trying to use to test one of our other wireless products. The device sends serial data to a PC through a USB port. I have written an automated LabVIEW program to test all the functions of my new product. However, after pulling in data, I have realized that the serial data comes in very fast and requires that I change the default Windows latency time for the COM port from 16ms to 2ms to not miss anything. This is easy enough for me to do locally on my machine, but much harder for me to spec for an offsite CM.
    Is there a way to have my LabVIEW program change the latency time of the Windows COM port from 16ms to 2ms automatically?  
    Solved!
    Go to Solution.

    EricBSEE wrote:
    I have a wireless data collection device my company makes that I am trying to use to test one of our other wireless products. The device sends serial data to a PC through a USB port. I have written an automated LabVIEW program to test all the functions of my new product. However, after pulling in data, I have realized that the serial data comes in very fast and requires that I change the default Windows latency time for the COM port from 16ms to 2ms to not miss anything. This is easy enough for me to do locally on my machine, but much harder for me to spec for an offsite CM.
    Is there a way to have my LabVIEW program change the latency time of the Windows COM port from 16ms to 2ms automatically?  
    I've never heard of this being an issue before.  Would you mind uploading your code so that we can see where the problem lies?
    Thanks! 
    Bill
    (Mid-Level minion.)
    My support system ensures that I don't look totally incompetent.
    Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.

  • How to reverse find through powershell script in contents of the file

    Hello All,
    Following script is to perform the find and replace in the files:
    [CmdletBinding(SupportsShouldProcess=$True)]
    param (
    [Parameter(Mandatory=$true)]
    [string] $inst1 = $null,
    [Parameter(Mandatory=$true)]
    [string] $inst2 = $null,
    [Parameter(Mandatory=$true)]
    [string] $FPath = $null
    (get-content $FPath) | foreach-object {$_ -replace $inst1, $inst2} | set-content $FPathAbove script find and replace from starting of the string in the file contents.Please suggest how to achieve find and replace from last of the string for example:string is a\b\c\d\e and find "\" from last and replace it with Test, output should be Teste.Thank You

    #string is a\b\c\d\e and find "\" from last and replace it with Test, output should be Teste.
    $string = 'a\b\c\d\e'
    $Replace = 'Test'
    $string -replace '.+\\',$Replace
    Teste
    [string](0..33|%{[char][int](46+("686552495351636652556262185355647068516270555358646562655775 0645570").substring(($_*2),2))})-replace " "

  • HT204266 How do I purchase a number of apps at one time with just one credit card transaction?  I am traveling and I pay an overseas conversion fee each time I use my credit card.

    How do I purchase a number of apps at one time through iTunes using just one credit card transaction.  So far it seems that each app purchase is a separate transaction.  Is there a shopping cart facility?  I can't find one if there is. I'm traveling so each credit card transaction is quite costly.
    Thanks!
    Ruth

    I wish this were true.
    It is true.
    You will be billed for iTunes purchase exactly the same as if you are at home. The CC company will not add any fees.
    When purchasing through iTunes, it is NOT an overseas transaction. The transaction will simply show up as a regular transaction in your iTunes store. You will be charged/billed according to your address in iTunes, not where you physically are located.
    When you make a purchase in a shop, the retailer ID/location is sent with the transaction allowing the CC company to figure the exchange rates and bill the correct amount.

  • Lync 2010 powershell script to call a voip phone

    Hi ,
    I am trying to call from Lync to IP phone through powershell script . ...can any one help me in this regard please ...
    Thanks,
    Srini

    Hi Sean ,
    Sorry i am new to the telecom domain and terminology is a bit tough for me ... i am trying to automate a Audio call with the modality settings . 
    to some extent i have succeeded in getting the call ..with the help of documentation ...below is the code for the same ... 
    But the problem is instead of calling the contact specified , it pops up a chat window in which it again asks to transfer the call to which user ... apparently its not taking the invitees i am specifying... can you please correct me where i am going
    wrong ...Thanks in advance ... 
    # Assume assembly is installed in the default installation directory
    $assemblyPath = “C:\Program Files (x86)\Microsoft Lync\SDK\Assemblies\Desktop\Microsoft.Lync.Model.DLL”
    # Import the assembly into the PowerShell session
    Import-module $assemblyPath
    $auto = [Microsoft.Lync.Model.LyncClient]::GetAutomation()
    #Create string array of conversation invitees.
    $invitees = @(‘[email protected]’)
    # Create a generic Dictionary object to contain conversation setting objects.
    $settings = new-object 'System.Collections.Generic.Dictionary[Microsoft.Lync.Model.Extensibility.AutomationModalitySettings, Object]'
    $settings.Add([Microsoft.Lync.Model.Extensibility.AutomationModalitySettings]::StartConferenceByCallingMeAt, $true)
    $modality = [Microsoft.Lync.Model.Extensibility.AutomationModalities]::Audio 
    # Start a conversation
    $ar = $auto.BeginStartConversation($modality,`
        $invitees -as [System.Collections.Generic.IEnumerable[string]], `
        $settings -as [System.Collections.Generic.IEnumerable[System.Collections.Generic.KeyValuePair[Microsoft.Lync.Model.Extensibility.AutomationModalitySettings, Object]]], `
        $null, $null) 
    #Block UI thread until conversation is started and Conversation Window is displayed.
    $window = $auto.EndStartConversation($ar)

  • Importing a multiple users Trough Powershell Scripts

    Hi All
    Am completely new to this technology am having a source code for “Adding a single user to a SG Group” similarly I need to Add a multiple users through PowerShell scripts.
    Set-Variable
    -Name
    GROUPNAME
    -Value
    "<My Group>"
    -Option
    Constant
    Set-Variable -Name
    USERNAME
    -Value "<My User>"
    -Option Constant
    Set-Variable -Name
    URI
    -Value "http://localhost:5725/resourcemanagementservice"
    -Option Constant
    Function GetSingleResource
    Param($Filter)
    End
    $exportResource
    = export-fimconfig
    -uri $URI
    `
    –onlyBaseResources
    `
    -customconfig ("$Filter")`
    -ErrorVariable Err
    `
    -ErrorAction SilentlyContinue
    If($Err){Throw
    $Err}
    If($exportResource
    -eq $null) {Throw
    "Resource not found: $Filter"}
    If(@($exportResource).Count
    -ne 1) {Throw
    "More than one resource found: $Filter"}
    $exportResource
    If(@(Get-PSSnapin
    | Where-Object {$_.Name
    -eq "FIMAutomation"} ).count
    -eq 0) {Add-PSSnapin
    FIMAutomation}
    Clear-Host
    $ProgressPreference
    = "SilentlyContinue"
    $ProgressPreference
    = "Continue"
    Write-Progress -Activity
    "Retrieving group object"
    `
    -Status "Please wait..."
    `
    -CurrentOperation
    "Processing step 1 of 3"
    $ProgressPreference
    = "SilentlyContinue"
    $groupObject
    = GetSingleResource
    -Filter "/Group[DisplayName='$GROUPNAME']"
    $ProgressPreference
    = "Continue"
    Write-Progress -Activity
    "Retrieving user object"
    `
    -Status "Please wait..."
    `
    -CurrentOperation
    "Processing step 2 of 3"
    $ProgressPreference
    = "SilentlyContinue"
    $userObject
    = GetSingleResource
    -Filter "/Person[DisplayName='$USERNAME']"
    $importChange
    = New-Object
    Microsoft.ResourceManagement.Automation.ObjectModel.ImportChange
    $importChange.Operation
    = 0
    $importChange.AttributeName
    = "ExplicitMember"
    $importChange.AttributeValue
    = $userObject.ResourceManagementObject.ObjectIdentifier
    $importChange.FullyResolved
    = 0
    $importChange.Locale
    = "Invariant"
    $importObject
    = New-Object
    Microsoft.ResourceManagement.Automation.ObjectModel.ImportObject
    $importObject.ObjectType
    = "Group"
    $importObject.TargetObjectIdentifier
    = $groupObject.ResourceManagementObject.ObjectIdentifier
    $importObject.SourceObjectIdentifier
    = $groupObject.ResourceManagementObject.ObjectIdentifier
    $importObject.State
    = 1
    $ImportObject.Changes
    = (,$ImportChange)
    $ProgressPreference
    = "Continue"
    Write-Progress -Activity
    "Adding user to group"
    `
    -Status "Please wait..."
    `
    -CurrentOperation
    "Processing step 3 of 3"
    $ProgressPreference
    = "SilentlyContinue"
    $importObject
    | Import-FIMConfig
    -Uri $URI
    -ErrorVariable
    Err -ErrorAction
    SilentlyContinue
    | Out-Null
    If($Err){Throw
    $Err}
    Write-Host "Command completed successfully"
    Trap
    Write-Host $_.Exception.Message
    -foregroundcolor
    white
    -backgroundcolor
    darkred
    Write-Host $_.Exception.GetType().FullName
    -foregroundcolor
    white
    -backgroundcolor
    darkred
    Write-Host "`n"
    Exit 1
    Regards:
    Rajesh.k

    What is your question?  Also, please refrain from dumping ~100 lines of code.  If you need help with a specific portion, please post just that and be clear with your question.
    Mike Crowley | MVP
    My Blog --
    Planet Technologies

  • Powershell script for Use this termset for site navigation in tem store management tool in central admin

    can anyone pls point out whats the power shell script for "use this  termset for site navigation" in the termstore management tool in my central  admin';s manage serv appln-->managed metadata serv appln ->term styore mgmnt tool
    i would like to check this "checked" through powershell script
    help is appreciated!

    Hi,
    To check if the term set has been set to be used for site navigation, we need to check the
    NavigationTermSet.IsNavigationTermSet property for the term set.
    Here is the code example for using PowerShell to get the setting:
    $site=Get-SPSite "your site collection URL";
    $session = Get-SPTaxonomySession -Site "your site collection URL ";
    $termStore = $session.TermStores["Managed Metadata Service"];
    $Group = $termStore.Groups[“Group Name”];
    $TermSet = $Group.TermSets[“Term Set Name”];
    $navTermSet = [Microsoft.SharePoint.Publishing.Navigation.NavigationTermSet]::GetAsResolvedByWeb($termset, $site.RootWeb, "GlobalNavigationTaxonomyProvider");
    write-host $navTermSet.IsNavigationTermSet
    Best regards.
    Thanks
    Victoria Xia
    TechNet Community Support

  • Executing powershell scripts via Task Scheduler

    Hi,
    I have a powershell script that I wrote that when executed from the shell works fine but when executed from task scheduler does not work.
    In my script, an email is sent out based on the results of the execution.  When I run this from the shell, email goes out, when scheduled, no email and there is no indication of errors having occurred anywhere in the system.
    Has anyone run into a similar issue?
    I did change my powershell execution policy to be unrestricted (both in the x86 and x64 consoles).  I am running Windows 2008 R2.
    Thanks - Greg.

    Hi,
    In addition the above suggestions, please also refer to the below threads:
    Using Task Scheduler for a powershell script on server 2008
    http://social.technet.microsoft.com/Forums/en-US/ITCG/thread/e298d613-47b8-4492-92d1-0b55cc8497c1
     Using Windows Task Scheduler to execute Powershell Script frequently
    http://social.technet.microsoft.com/Forums/en-US/winserverpowershell/thread/5901a6ad-ba18-4817-82a9-f75d2d6b439f
    Hope this helps.
    Best Regards,
    Yan Li
    Yan Li
    TechNet Community Support

  • May I deploy MS patches on windows servers, and reboot the servers later?

    Hello,
    I am trying to steam line patching process. May I deploy MS patches on the windows servers first and then reboot the servers at a later time? say days later.
    Tiffany

    For CCM, that is a big no. You need to get the updates that have been approved by Cisco from Cisco. They are available at the following link. Read the release notes very carefully! There are very strict upgrade sequences. I suggest that you consider upgrading to UCM 6 or 7; the updating process is much easier.
    Cisco Unified CallManager Version 4.1 > Voice Application OS and BIOS Updates
    For Unity, you can typically download and run the Update Wizard which will have the approved updates rolled in. Depending on how immediate you want to be about it, there is also a support policy for Windows Update
    Software Installed by the Cisco Unity Server Updates Wizard in 2009 .

  • How to run Powershell script (function) through Windows Task Schduler ??

    Hello All,
    i have Powershell script which is created as a function. I have to give parameters to run the script. And it is working fine. Now i want to run this script through windows task scheduler but it is not working. I dont know how to call powershell function
    through task scheduler.
    From command line i run it like this:
    . c:\script\Get-ServiceStatusReport.ps1
    dir function:get-service*
    Get-ServiceStatusReport -ComputerList C:\script\server.txt -includeService "Exchange","W32Time" -To [email protected] -From [email protected] -SMTPMail mail01.xxx.gov.pk
    In windows Task scheduler I am giving this: it runs but i dont receive any output :
    Program/Script:
    C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe
    Parameter:
    -file ". 'Get-ServiceStatusReport.ps1 -ComputerList C:\script\server.txt -includeService  "Exchange","W32Time" -To [email protected] -From [email protected] -SMTPMail  mail01.xxx.gov.pk'"
    Please HELP !!!

    Thanks for the reply:
    The script is already saved as Get-ServiceStatusReport.ps1 .
    On powershell it does not run like .\Get-ServiceStatusReport.ps1 (parameter).
    But i have to call it as function:
    Like this:
    Get-ServiceStatusReport -ComputerList C:\script\server.txt -includeService "Exchange","W32Time" -To [email protected] -From [email protected] -SMTPMail mail01.xxx.gov.pk
    As you said:
    I tried to run it like this:
    Program/Script:
    C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe
    Parameter:
    -file "c:\script\Get-ServiceStatusReport.ps1 -ComputerList C:\script\server.txt -includeService  "Exchange","W32Time" -To [email protected] -From [email protected] -SMTPMail  mail01.xxx.gov.pk'"
    But its not working , on scheduler its giving error: (0xFFFD0000)
    Please HELP !!!
    WHOLE SCRIPT:
    function Get-ServiceStatusReport
    param(
    [String]$ComputerList,[String[]]$includeService,[String]$To,[String]$From,[string]$SMTPMail
    $script:list = $ComputerList
    $ServiceFileName= "c:\ServiceFileName.htm"
    New-Item -ItemType file $ServiceFilename -Force
    # Function to write the HTML Header to the file
    Function writeHtmlHeader
    param($fileName)
    $date = ( get-date ).ToString('yyyy/MM/dd')
    Add-Content $fileName "<html>"
    Add-Content $fileName "<head>"
    Add-Content $fileName "<meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'>"
    Add-Content $fileName '<title>Service Status Report </title>'
    add-content $fileName '<STYLE TYPE="text/css">'
    add-content $fileName "<!--"
    add-content $fileName "td {"
    add-content $fileName "font-family: Tahoma;"
    add-content $fileName "font-size: 11px;"
    add-content $fileName "border-top: 1px solid #999999;"
    add-content $fileName "border-right: 1px solid #999999;"
    add-content $fileName "border-bottom: 1px solid #999999;"
    add-content $fileName "border-left: 1px solid #999999;"
    add-content $fileName "padding-top: 0px;"
    add-content $fileName "padding-right: 0px;"
    add-content $fileName "padding-bottom: 0px;"
    add-content $fileName "padding-left: 0px;"
    add-content $fileName "}"
    add-content $fileName "body {"
    add-content $fileName "margin-left: 5px;"
    add-content $fileName "margin-top: 5px;"
    add-content $fileName "margin-right: 0px;"
    add-content $fileName "margin-bottom: 10px;"
    add-content $fileName ""
    add-content $fileName "table {"
    add-content $fileName "border: thin solid #000000;"
    add-content $fileName "}"
    add-content $fileName "-->"
    add-content $fileName "</style>"
    Add-Content $fileName "</head>"
    Add-Content $fileName "<body>"
    add-content $fileName "<table width='100%'>"
    add-content $fileName "<tr bgcolor='#CCCCCC'>"
    add-content $fileName "<td colspan='4' height='25' align='center'>"
    add-content $fileName "<font face='tahoma' color='#003399' size='4'><strong>Service Stauts Report - $date</strong></font>"
    add-content $fileName "</td>"
    add-content $fileName "</tr>"
    add-content $fileName "</table>"
    # Function to write the HTML Header to the file
    Function writeTableHeader
    param($fileName)
    Add-Content $fileName "<tr bgcolor=#CCCCCC>"
    Add-Content $fileName "<td width='10%' align='center'>ServerName</td>"
    Add-Content $fileName "<td width='50%' align='center'>Service Name</td>"
    Add-Content $fileName "<td width='10%' align='center'>status</td>"
    Add-Content $fileName "</tr>"
    Function writeHtmlFooter
    param($fileName)
    Add-Content $fileName "</body>"
    Add-Content $fileName "</html>"
    Function writeDiskInfo
    param($filename,$Servername,$name,$Status)
    if( $status -eq "Stopped")
    Add-Content $fileName "<tr>"
    Add-Content $fileName "<td bgcolor='#FF0000' align=left ><b>$servername</td>"
    Add-Content $fileName "<td bgcolor='#FF0000' align=left ><b>$name</td>"
    Add-Content $fileName "<td bgcolor='#FF0000' align=left ><b>$Status</td>"
    Add-Content $fileName "</tr>"
    else
    Add-Content $fileName "<tr>"
    Add-Content $fileName "<td >$servername</td>"
    Add-Content $fileName "<td >$name</td>"
    Add-Content $fileName "<td >$Status</td>"
    Add-Content $fileName "</tr>"
    writeHtmlHeader $ServiceFileName
    Add-Content $ServiceFileName "<table width='100%'><tbody>"
    Add-Content $ServiceFileName "<tr bgcolor='#CCCCCC'>"
    Add-Content $ServiceFileName "<td width='100%' align='center' colSpan=3><font face='tahoma' color='#003399' size='2'><strong> Service Details</strong></font></td>"
    Add-Content $ServiceFileName "</tr>"
    writeTableHeader $ServiceFileName
    #Change value of the following parameter as needed
    $InlcudeArray=@()
    #List of programs to exclude
    #$InlcudeArray = $inlcudeService
    Foreach($ServerName in (Get-Content $script:list))
    $service = Get-Service -ComputerName $servername
    if ($Service -ne $NULL)
    foreach ($item in $service)
    #$item.DisplayName
    Foreach($include in $includeService)
    write-host $inlcude
    if(($item.serviceName).Contains($include) -eq $TRUE)
    Write-Host $item.MachineName $item.name $item.Status
    writeDiskInfo $ServiceFileName $item.MachineName $item.name $item.Status
    Add-Content $ServiceFileName "</table>"
    writeHtmlFooter $ServiceFileName
    function Validate-IsEmail ([string]$Email)
    return $Email -match "^(?("")("".+?""@)|(([0-9a-zA-Z]((\.(?!\.))|[-!#\$%&'\*\+/=\?\^`\{\}\|~\w])*)(?<=[0-9a-zA-Z])@))(?(\[)(\[(\d{1,3}\.){3}\d{1,3}\])|(([0-9a-zA-Z][-\w]*[0-9a-zA-Z]\.)+[a-zA-Z]{2,6}))$"
    Function sendEmail
    param($from,$to,$subject,$smtphost,$htmlFileName)
    [string]$receipients="$to"
    $body = Get-Content $htmlFileName
    $body = New-Object System.Net.Mail.MailMessage $from, $receipients, $subject, $body
    $body.isBodyhtml = $true
    $smtpServer = $MailServer
    $smtp = new-object Net.Mail.SmtpClient($smtphost)
    $validfrom= Validate-IsEmail $from
    if($validfrom -eq $TRUE)
    $validTo= Validate-IsEmail $to
    if($validTo -eq $TRUE)
    $smtp.UseDefaultCredentials = $true;
    $smtp.Send($body)
    write-output "Email Sent!!"
    else
    write-output "Invalid entries, Try again!!"
    $date = ( get-date ).ToString('yyyy/MM/dd')
    sendEmail -from $From -to $to -subject "Service Status - $Date" -smtphost $SMTPMail -htmlfilename $ServiceFilename

  • Can we Monitor third party Windows servers through Cisco Prime

    Hi Team,
    We are  using  Cisco Prime assurance and  are currently monitoring Cisco UCCE Components through it.
    Meanwhile we have   few third party  windows servers , which we would like to monitor it through Cisco Prime , just to maintain a single monitoring tool.
    If yes, please share the steps or link.Also highlight the limitations in that.
    Regards,
    krishna

    Seems Cisco Prime Assurance Manager is now obsolete and end of life already.
    It is replaced by Cisco Prime Infrastructure. CPI supports third party/vendor devices to some minimum extent with limited management details collected via SNMP Templates.
    -Thanks
    Vinod
    **Encourage Contributors. RATE Them.**

Maybe you are looking for

  • Lack of support for mpeg2 is moraly wrong !

    I feel it is morally wrong for this application to not support the native format of the end product. Dvd is mpeg2 -- mpeg2 is dvd. How can you possibly sell a product that does not support the native format of the product. I have seen comment that ap

  • Obsolete ABAP statements in OOPs context

    Obsolete ABAP statements in OOPs context

  • Vision assistant steps to be followed for pattern matching

    I am acquiring color images of hands movement using web camera of laptop. I want to process the acquired images to use for pattern matching. What are the steps to be followed to achieve the above mentioned task.

  • Invisible or buggy Mail Rule

    Oh boy, how to describe this? Let me try... I've been creating mail rules to shunt spam to the junk box. They work as expected. I don't like to click on a spam email, because if the images load, then the spammers get confirmation of a "live" email ad

  • Do i need to enter my billing info?

    I was using my iPad and i tried to get a free app. When the app was downloading it told me to enter my billing info. I will not give that information away. Is there anything else i can do to get apps?