zoukankan      html  css  js  c++  java
  • Sqler 工具 CMd 更新

    Sqler 工具 CMd 更新

    sqler工具介绍(监控一)

    sqler工具介绍(监控二)

    sqler 工具介绍(报表)

    sqler工具介绍(cmd)

     

    新加入 CMD 功能

    1  多线程远程创建文件夹

    2 多线程远程操作服务

    3 多线程远程 操作windows账户

    4 多线程远程机器 加域、删域

    5 多线程远程添加 防火墙端口

    加域模块

    复制代码
     1 #region  JoinDomain
     2 WorkFlow WFSqlerCmdJoinDomain
     3 {
     4 param([array] $servers,[string] $Domain
     5 ,[string] $WmiAccount,[string] $WmiPassWord
     6 ,[array] $dns
     7 ,[string]$Logfile ='E:\Monitor\SqlerCmdLog')
     8  foreach -parallel($server in $servers)
     9  {
    10   inlinescript
    11   {
    12    try
    13    {
    14      $date=get-date
    15      $PWD= ConvertTo-SecureString $using:WmiPassWord -AsPlainText -Force
    16      $psc = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList $using:WmiAccount,$PWD  -ErrorAction Stop
    17      $dpsc = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList "$Using:Domain\$using:WmiAccount",$PWD  -ErrorAction Stop;
    18      ##Set DNS
    19      $IP=Get-WmiObject Win32_NetworkAdapterConfiguration -ComputerName  $using:server  -Credential  $psc  -ErrorAction Stop `
    20      | Where{$_.IPEnabled -eq "TRUE" -and  $_.ipaddress -eq   $using:server}
    21      $Return=$IP.SetDNSServerSearchOrder( $Using:Dns);
    22       Add-Computer  -ComputerName $using:server -Credential $dpsc -DomainName $using:domain -LocalCredential $psc  -Restart -Force -ErrorAction stop
    23      "Succeed $using:server Begin:$date Server:$using:Server is join $using:Domain----"|out-file -FilePath  "$using:Logfile\SqlerCmdJoinDomainSucceed_$using:server.log"  -Append
    24     }
    25    catch
    26    {
    27      $date=get-date
    28     "Failed '$using:server' error info : "+$_.Exception.Message|out-file -FilePath  "$using:Logfile\SqlerCmdJoinDomainFailed_$using:server.log"  -Append
    29    }
    30   }
    31  }
    32   inlinescript
    33  {
    34   if((Test-Path -Path "$Using:Logfile\SqlerCmdJoinDomainFailed.log" )){Remove-Item -Path "$Using:Logfile\SqlerCmdJoinDomainFailed.log" }
    35   if((Test-Path -Path "$Using:Logfile\SqlerCmdJoinDomainSucceed.log" )){Remove-Item -Path "$Using:Logfile\SqlerCmdJoinDomainSucceed.log" }
    36   Get-ChildItem -path $using:Logfile -recurse -include "*.log"| where {$_.Name -match 'SqlerCmdJoinDomain'  -and  $_.Name -match '_' } `
    37  |ForEach-Object{  if($_ -match 'Failed'){Get-Content  $_ |out-file -FilePath  "$Using:Logfile\SqlerCmdJoinDomainFailed.log"  -Append;Remove-Item -path $_ } Else{Get-Content  $_ |out-file -FilePath  "$Using:Logfile\SqlerCmdJoinDomainSucceed.log"  -Append;Remove-Item -path $_ }}
    38   }
    39  }
    40 
    41 #endregion

    42 WFSqlerCmdJoinDomain   $servers $domain $WmiAccount  $WmiPassWord  $dns


    复制代码

    因牵涉到信息安全,部分信息作了处理

    PS C:\Users\Administrator> cat E:\Monitor\SqlerCmdLog\SqlerCmdJoinDomainSucceed.log

    Succeed 192.168.xx.xxx Begin:04/02/2013 11:50:22 Server:192.168.xx.xxx is join xxdb----
    Succeed 192.168.xx.xxx Begin:04/02/2013 11:50:22 Server:192.168.xx.xx is join xxdb----
    PS C:\Users\Administrator>

    练一技,修百艺,而成于自然.
     
    分类: Tool:Sqler
  • 相关阅读:
    jmeter的beanshell脚本编写
    基于 Flask 的简易 Mock 平台
    mock-server
    linux环境jmeter- java环境安装配置
    服务器监控环境搭建 telegraf+influxdb+grafana框架
    聚类算法:凝聚层次聚类
    python中cursor操作数据库
    python中if __name__ == '__main__': 的解析
    python连接mysql数据库
    Python3.5,flask在命令行执行 [python] view plain copy import pymysql 连接mysql数据库MySQLdb
  • 原文地址:https://www.cnblogs.com/Leo_wl/p/2996756.html
Copyright © 2011-2022 走看看