我有一些clarofocation [英] I have some clarofocation

查看:87
本文介绍了我有一些clarofocation的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想要以下PowerShell脚本的前端编码



谢谢



N Mayilazhagan




I Want front end coding for below powershell script

Thanks

N Mayilazhagan


$ServerName= read-host "Please enter your Server Name:"
$UserName=read-host "Please enter your user name"
$EncrPassword=Read-Host "Enter Password" -assecurestring 
$Password=[System.Runtime.InteropServices.Marshal]::PtrToStringAuto([System.Runtime.InteropServices.Marshal]::SecureStringToBSTR($EncrPassword))
$databaseName= read-host "Please enter your database Name"

write-host ""
$out="D:\tools\ExecutionLog.txt"
$FolderPath= "D:\tools\test"
$SQLFiles = Get-ChildItem $FolderPath | where {!$_.PsIsContainer} 
foreach($file in $SQLFiles) 
{
    write-host ""
	write-host $file
    $file.Name | Out-File -Filepath $out -append
	$file=$FolderPath+"\"+$file
    
    sqlcmd -U $UserName -P $Password -b -S $ServerName -d $databaseName -i $file

    if($LASTEXITCODE -eq 0)
    {
        write-host ""
        write-host "Success"
        "Success" | Out-File -FilePath $out  -append
    	"" | Out-File -FilePath $out  -append
    	write-host ""
    }
    else
    {
        Get-Content $out
    	Get-Content $out | Out-File -FilePath $out  -append
    	"" | Out-File -FilePath $out  -append
    }
}

Start-Process notepad -WindowStyle normal $out

推荐答案

ServerName = read-host请输入您的服务器名称:
ServerName= read-host "Please enter your Server Name:"


UserName = read-host请输入您的用户名
UserName=read-host "Please enter your user name"


EncrPassword =读取主机输入密码-assecurestring
EncrPassword=Read-Host "Enter Password" -assecurestring


这篇关于我有一些clarofocation的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆