powershell

解决ASP.NET Core部署到IIS,更新项目"另一个程序正在使用此文件,进程无法访问"...

≡放荡痞女 提交于 2020-12-24 13:41:57
问题 部署到IIS上的ASP.NET Core项目,在更新的时候会进程占用的错误 解决思路 初步解决方案: 1,关闭应用程序池 2,关闭网站 3,更新项目 缺点:网站没法访问,部署项目停的时间过长 答案 查询官方文档后,官方给出的方案: 如果应用正在运行,部署文件夹中的文件会被锁定。 在部署期间,无法覆盖已锁定的文件。 若要在部署中解除已锁定的文件,请使用以下方法之一 停止应用池: 使用 Web 部署并在项目文件中引用 Microsoft.NET.Sdk.Web。 系统会在 Web 应用目录的根目录中放置一个 app_offline.htm 文件 。 该文件存在时,ASP.NET Core 模块会在部署过程中正常关闭该应用并提供 app_offline.htm 文件 。 有关详细信息,请参阅 ASP.NET Core 模块配置参考。 在服务器上的 IIS 管理器中手动停止应用池。 使用 PowerShell 删除 app_offline.html (需要使用 PowerShell 5 或更高版本): PowerShell $pathToApp = 'PATH_TO_APP' # Stop the AppPool New-Item -Path $pathToApp app_offline.htm # Provide script commands here to deploy the

win10 专业版 git bash 闪退问题终极解决方案

早过忘川 提交于 2020-12-24 07:29:03
问题描述 Win10 64位专业版安装git 2.x之后出现 Git闪退,安装1.x出现bash: /dev/null: No such device or address fatal: open /dev/null or dup failed: No such file or directory 错误。 背景描述 由于换了新系统(OS是Win10 64专业版),需要重新安装Git,于是去官网下了Git的最新版本,安装完之后,发现不能用,一点开Git bash 就退出了,不知道怎么回事。我以前win10 家庭版也是官网下的最新版本,可以正常使用。于是,我初步断定是操作系统的原因,问了身边的同事,他们也都是win10,但是安装Git的时候没有出现类似的问题,很顺利的安装成功,但他们貌似都不是Win10专业版,都是什么家庭版,旗舰版。于是我去网上寻找答案,大家都知道网上的答案五花八门,很多是针对win7的,针对win10 的很少,且有的答案按照其说的做了仍然不能解决问题,下面我将分享我解决问题的 过程。 问题解决过程描述 网上有答案说是C:/Window/System32/drivers/null.sysnull.sys 这个系统文件损坏,于是我从同事那里拷贝一个过来,覆盖之,重启。没有解决问题 以管理员身份运行CMD,在CMD下输入 sfc /scannow 进行系统扫描修复

PowerShell enumerate an array that contains only one inner array

怎甘沉沦 提交于 2020-12-23 11:14:34
问题 Conside this: This is one array and contains only one item. And the item of the array is another array(I call it list object). I want to get the only list object inside an array. I use foreach to get the list, but it treates the list object as an array and return the first item of the list object. $OSName1 = @( @("win2008r2") ) $OSName2 = @( @("win2008r2"), @("win2012") ) foreach ($osname in $OSName1) { write-host $osname[0] } foreach ($osname in $OSName2) { write-host $osname[0] } I expect

PowerShell enumerate an array that contains only one inner array

痞子三分冷 提交于 2020-12-23 11:07:27
问题 Conside this: This is one array and contains only one item. And the item of the array is another array(I call it list object). I want to get the only list object inside an array. I use foreach to get the list, but it treates the list object as an array and return the first item of the list object. $OSName1 = @( @("win2008r2") ) $OSName2 = @( @("win2008r2"), @("win2012") ) foreach ($osname in $OSName1) { write-host $osname[0] } foreach ($osname in $OSName2) { write-host $osname[0] } I expect

怎么查找微信服务器的IP地址

♀尐吖头ヾ 提交于 2020-12-19 13:46:28
我们在做网络安全测试时,首先要知道目标服务器的地址,否则一切都是空谈,今天我们就找一下微信的服务器IP地址;废话不多说,直接开始搞。 首先,让微信客户端在pc端运行,在任务管理器--详细信息中,找到WeChat.exe的进程,找到PID 就是微信进程的ID号 打开一个命令行窗口,cmd或者powershell窗口都可以,我这里习惯使用powershell,看着舒服一些 输入命令 netstat -ano|findstr 14596 #这里使用我们上面找到的PID号,进行查找 我们这里就找到了服务器的ip地址。ping一下试试 没问题地址是通的,端口号是443,安全网络web端口。 来源: oschina 链接: https://my.oschina.net/u/4297302/blog/4816378

Determine Virtual Machine status and activity in Microsoft Azure

旧时模样 提交于 2020-12-15 06:53:26
问题 I have an account with Azure and different subscriptions with different Resource Group and different virtual machine. I would like to know how I can determine which ones are unused. For example check the last date where the virtual machine was started or used by the user using a powershell script. 回答1: PowerShell Method Within PowerShell you can use the following command to query the VM API. You want to look at the Provisioning Status and Time, as well as the Running Status: Connect

In PowerShell, pass a complex object (SmoServer) to a background job in the ArgumentList - stuck in “NotStarted”

家住魔仙堡 提交于 2020-12-15 06:45:33
问题 I am trying to pass a pre-built SmoServer object to a background job, to parallelize some operations against multiple SQL Servers. However, when I try to do this, the Child job of the invoked job gets stuck in a "NotStarted" state. A very basic test: [void][System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SqlServer.SMO") $SmoServer = New-Object Microsoft.SqlServer.Management.Smo.Server MySqlServer Start-Job -Name Test -ScriptBlock { param($SmoServer) $SmoServer.Databases.Name }

Format CSV file output using powershell

痞子三分冷 提交于 2020-12-15 06:43:56
问题 I wrote the following code that stores certificates details in a csv file. It works but in each line of the csv file the symbols @{ at the beginning and } at the end are written.also in the first column which contains the headers the symbol = is also written. So I did not know how populate my csv file without these symbols Here is the code that I wrote $StartDate = Get-Date $CertPath = 'Cert:\LocalMachine\' $CertsDetail = Get-ChildItem -Path $CertPath -Recurse | Where-Object {$_.PsIsContainer

Populate ComboBox2 depending on ComboBox1 selection

喜欢而已 提交于 2020-12-15 06:17:57
问题 Few days of searching and trying multiple options, but nothing is working actually. With the previous code posted. I've imported all my objects from XAML (all set in variables), I don't know if that would be a problem for that. I don't think since everything else seems to work properly. I just want my Tab2CBB2 to show values depending on the selection of Tab1CBB1. Anyone could help ? (I haven't paste the entire code, neither the paths but you can probably help me with that). Note that those

Populate ComboBox2 depending on ComboBox1 selection

醉酒当歌 提交于 2020-12-15 06:17:47
问题 Few days of searching and trying multiple options, but nothing is working actually. With the previous code posted. I've imported all my objects from XAML (all set in variables), I don't know if that would be a problem for that. I don't think since everything else seems to work properly. I just want my Tab2CBB2 to show values depending on the selection of Tab1CBB1. Anyone could help ? (I haven't paste the entire code, neither the paths but you can probably help me with that). Note that those