Edi Wang

.NET and Azure Developer

PowerShell

PowerShell to Enable SQL Server Express Remote Access

SQL Server Express is a free edition of Microsoft's SQL Server, which is a relational database management system (RDBMS). However, remote access is not enabled by default on this SKU. To access a SQL Server Express instance from the network, we have to do a few steps. There's plenty of guide on the internet telling you how to enable remote access via GUI, but I would like to do it from PowerShell. …
SQL Server PowerShell

Use Azure Function to Schedule Auto Start for VMs

VMs on the Microsoft Azure platform can be configured to automatically shut down by schedule. However, currently only VMs in the DevTest Lab service can be powered on automatically. Regular VMs have not been updated with the auto start capability. But still, we can take advantage of Azure Function V3 and PowerShell Core to start the VM by timed schedule. The Idea I have wrote a post 6 year ago …
Azure PowerShell VM Azure Function

Incremental Build Number for .NET Core via Azure DevOps

People familiar with the. NET framework knows that we can let the compiler self-increase the version number by specifying AssemblyVersion as 10.0.*. But. NET core and. NET Standard are not. Even with open-source projects like MSBump, there are certain flaws. Typically, such a requirement happens on a CI/CD server. Let's take a look at how to easily handle it with Azure DevOps. About Versioning in …
.NET PowerShell Azure DevOps

Automate Windows 10 Developer Machine Setup

One of the things programmers hate most is probably setup a computer. Because the programmer's computer environment configuration is very different from normal people. In general, it takes several hours to manually install a new development machine. Let this process automating, after all, the essence of programming is to let complex things simplify, find a way to be lazy! In fact, automatic …
Windows PowerShell Choco

如何定时开关机Microsoft Azure上的虚拟机

作为一个屌丝,用Azure的时候得处处想着省钱,在你不用虚拟机的时候关机是个省钱的好办法。当然,每天手动登录Portal去开关机比较麻烦。如果你用VM的时间段比较固定,可以做个定时开关机的任务帮你省钱。 做法是用一台机器作为Controller,在上面建立开关机任务,调度Azure上的VM。比如你自己的机器每天早上8点开机,下午5点关机。你希望Azure上的某台VM早上8:30开机,下午4:30关机。那你就可以把自己的机器作为Controller。当然,你也可以在Azure上开一台专门作为Controller的Server,给它分配一个768MB内存的屌丝instance(diaostance)来省钱。 这台Controller机器上必须安装Microsoft Azure PowerShell,并且要在PowerShell里登录一次Azure。本文不再叙述,具体做法请看我之前写的《图解 …
Azure PowerShell VM

图解:使用Azure PowerShell创建和删除虚拟机

昨天教了大家如何使用Windows Azure PowerShell启动和关闭虚拟机,但光会用PS开关机还是不够的。如果你还在用网页版Portal创建和删除虚拟机,而只用PS去开关机,逼格明显就不完整了。所以今天再教大家如何用Windows Azure PowerShell创建和删除虚拟机,完成整个装逼过程。 首先,使用Windows Azure PowerShell登录Azure账户的步骤不再重复了,上一篇文章里有。假定你已经登录了。 如果你想查看虚拟机列表命令是: Get-AzureVM 1. 要创建虚拟机需要获得一些前置信息。第一个是你的订阅名称。运行这条命令获得: Get-AzureSubscription 在我的例子中,结果是Windows Azure MSDN - Visual Studio Ultimate。这是一个一年价值12w的订阅,大家不要在意这些细 …
Azure PowerShell VM

图解:使用Windows Azure PowerShell启动和关闭虚拟机

我们在使用Azure的时候,如果只会用网页版portal操作是没有逼格的。如果你不在命令行里啪啪啪的敲点东西,就会被Linux狗、Java狗、开源狗鄙视,他们会说用微软产品的人只会用图形界面,微软的程序员只会拖控件。为了挽回我们的逼格,大微软提供了Windows Azure PowerShell,能够让我们以命令行方式操作Azure。今天就教大家如何用Windows Azure PowerShell启动和关闭你的虚拟机。 如果你没安装Windows Azure PowerShell,可以通过大微软的Web Platform Installer安装,本文不再啰嗦怎么安装,反正WPI都是一键搞定的。 启动Windows Azure PowerShell后,第一件事就是要登录你的Azure账户。键入以下命令后会弹出登录界面: Add-AzureAccount 登录完成后, …
Azure PowerShell VM

使用PowerShell操作Windows Event Log

PowerShell是个很牛逼的命令行工具,在Windows 7以后的系统里都默认自带。学会了PowerShell就可以提升逼格,让妹子崇拜。今天就教大家用PowerShell操作Windows的Event Log。 首先,启动PowerShell很简单,只需要在开始菜单里输入Power,就能找到了(Windows 8用户可以直接在开始屏幕里搜索Power)。 启动PowerShell后,你可以看到一个这样的界面。和CMD不同,它是深蓝色背景的,并且路径前多了PS前缀。看起来很厉害的样子: 有用程序写过Windows Event Log的童鞋都知道,我们的首要任务是创建一个Log和一个Source。PowerShell里语法如下: new-eventlog -LogName 日志名称 -Source 源名称 比如,我们创建一个Name为Game,Source为CS的Log,可以这样写: …
Windows PowerShell EventLog