随笔分类 - PowerShell
摘要:$strConn="Data Source=.;Initial Catalog=AdventureWorksDW2008R2;Integrated Security=True;"$conn=New-Object System.Data.SqlClient.SqlConnection$conn.ConnectionString=$strConn$conn.Open()$comm=$conn.CreateCommand()$comm.CommandText="SELECT TOP 1000 [FullDateAlternateKey],[WeekNumberOfYea
阅读全文
摘要:[void][reflection.assembly]::LoadFile("C:\Program Files\Microsoft.NET\ADOMD.NET\100\Microsoft.AnalysisServices.AdomdClient.dll") $conn = New-object Microsoft.AnalysisServices.AdomdClient.AdomdConnection;write-host "Server(default localhost):"$strServer= read-hostwrite-host "
阅读全文
摘要:2010年十月11日到29日的PowerTip of the Day:删除错误记录,改变ErrorAction,使用Break,理解变量继承(作用域),创建静态变量,使用私有变量,改变控制台颜色,重置控制台颜色,清空控制台内容,显示可用的字符集(?),把字符集转换成国家名,执行程序并且保持联系(即对它的控制),以提升模式(?)运行程序,使用不同的用户运行程序,根据关键字查找方法。
阅读全文
摘要:2010年九月25日到十月8日的PowerTip of the Day:让powershell脚本在另外一个 powershell控制台运行的方法,创建一个Event Logs,打开系统日志界面,使用Write-Cmdlets需要注意的地方,Write-output方法,Write-ouput需要注意的地方,下载网页内容,截取网页里的内容,获取powershell团队博客的题目,使用Continue。
阅读全文
摘要:2010年九月13日到24日的PowerTip of the Day:辨别64位环境,查找静态方法,提示输入密码,通过控制台的方式提示输入密码,通过控制台提示输入密码,获取字幕列表,获取短日期型,查找闰年,查看一个月有几天,查看最大值
阅读全文
摘要:2010年九月7日到10日的PowerTip of the Day:查找WMI实例的路径,通过类型转换访问事件日志,链式类型转换,查找指定字符的数量
阅读全文
摘要:摘要: 2010年八月30日到九月3日的PowerTip of the Day:使用脚本验证输入的参数,查看对象的继承关系,版本对照,类型加速器(?),直接访问WMI实例
阅读全文
摘要:2010年八月份23日到27日的PowerTip of the Day:限制String类型参数的长度,用正则验证输入的参数,用Powershell查看对象类型,转换对象类型,限制数字参数范围。
阅读全文
摘要:2010年八月份16日到20日的PowerTip of the Day:对输入参数进行集合验证,定义属性简称,根据参数名查找Cmdlets,删除所有IE的Cookies,限制参数个数。
阅读全文
摘要:2010年八月份9日到13日的PowerTip of the Day:读取“神奇密码”,显示16进制文件,删除最近浏览文件夹,批量更改文件扩展名,显示IE的Cookies。
阅读全文
摘要:2010年八月份2日到6日的PowerTip of the Day:降低进程优先级,添加新的事件日志源 ,写入日志,查看用户桌面的文件夹目录,操作Path下的方法
阅读全文
摘要:2010年七月份26日到30日的PowerTip of the Day。Finding Interesting WMI Classes,Getting Help for WMI Classes,Calling ChkDsk via WMI,Renewing all DHCP Leases,Getting Help on WMI Methods
阅读全文
摘要:Getting Visual Help for PowerShell Cmdlets,Finding Available .NET Frameworks,Checking for .NET Framework Version
阅读全文
摘要:原文地址:http://app.en25.com/e/es.aspx?s=1403&e=5560&elq=e4af9624a0344403b24bcf81d6722d83原文:There are actually two different ways of manipulating dates and times. Here is the high-level approach t...
阅读全文
摘要:原文地址:http://app.en25.com/e/es.aspx?s=1403&e=5491&elq=8184bb918aa3406299da2caa939745da原文:A time span represents a time interval, and you can use time spans to subtract or add time to a date. Fo...
阅读全文
摘要:原文地址:http://app.en25.com/e/es.aspx?s=1403&e=5441&elq=3d32771b868b437aa97567a6a50b5563原文:Mandatory parameters are special because if you do not submit it, PowerShell will automatically ask for ...
阅读全文
摘要:原文地址:http://app.en25.com/e/es.aspx?s=1403&e=5382&elq=d8bc53b04e51496c9e3ef39e28976a68原文:You should simply copy and paste the following block comment right above your functions and magically Ge...
阅读全文
摘要:原文地址:http://app.en25.com/e/es.aspx?s=1403&e=5363&elq=654deccd50454fa7ac6cf57ea12b905a原文:Ever wanted to open the current PowerShell folder in an Explorer view? Try this:ii .This will work as lo...
阅读全文
摘要:原文地址:http://app.en25.com/e/es.aspx?s=1403&e=5287&elq=ffdaeb1db50d44cd98829640038cf0d4原文:If you need to filter running processes by owner, for example to terminate the ones owned by some user, ...
阅读全文
摘要:原文地址:http://app.en25.com/e/es.aspx?s=1403&e=5231&elq=4427f8ad0f9245da87fb793497c0753a原文:If your script needs to know whether your computer has a battery, you can ask WMI. Here is a small funct...
阅读全文