
PowerShell
文章平均质量分 68
Burgess_Liu
这个作者很懒,什么都没留下…
展开
-
Set-location:A positional parameter cannot be found that accepts argument 'Shell\Microsoft'.
Using the command Set-location, the error message maybe displayed. You can use double quotes to solve it.原创 2011-12-21 09:14:53 · 5536 阅读 · 1 评论 -
Managing SQL Server Client Aliases with WMI Provider
SQL Server client aliases make user connections easier, faster, and more convenient. Each alias saves all the information you need to connect to a SQL Server, such as the server name and the client pr原创 2012-03-22 09:51:16 · 1225 阅读 · 0 评论 -
WMI Provider for Server Events
You can use WMI to monitor server events.This provider manages a WMI namespace for each instance of SQL Server 2008. The name of the namespace is in the formatroot\Microsoft\SqlServer\ServerEvents\i原创 2012-03-22 13:20:06 · 887 阅读 · 0 评论 -
Changing FILESTREAM Settings
By default, FILESTREAM is disabled. Before starting to use it on a SQL Server instance, FILESTREAM needs to be enabled on the instance. The FILESTREAMSettings class provides an EnableFILESTREAM method原创 2012-03-22 11:15:26 · 851 阅读 · 0 评论 -
WMI Query Language (WQL)
The WMI Query Language (WQL) is designed to perform queries against the CIM repository to retrieve WMI information. WQL is a subset of ANSI SQL with minor semantic changes to support WMI. Therefore,it原创 2012-03-22 13:31:18 · 2853 阅读 · 0 评论 -
Event Handling with Windows PowerShell 2.0
Unlike Windows PowerShell 1.0, for which you need to use .NET classes, such as the System.Management.ManagementEventWatcher class to subscribe and monitor events, Windows PowerShell 2.0 CTP3 provides原创 2012-03-22 15:25:57 · 1825 阅读 · 0 评论 -
Managing Server Network Protocols with WMI Provider
To view the list of properties associated with each network protocol for the default instance on the local computer:Get-WmiObject -namespace root\Microsoft\SqlServer\ComputerManagement10 -class Serv原创 2012-03-22 10:56:01 · 927 阅读 · 0 评论 -
Changing SQL Server Advanced Properties with WMI Provider
Suppose the file system is corrupted,in which case you need to restore every database, including the master database. To restore the master database, you need to start the SQL Server in single-user mo原创 2012-03-22 12:32:06 · 846 阅读 · 0 评论 -
无法将“Invoke-SqlCmd”项识别为 cmdlet、函数、脚本文件或可运行程序的名称。
今天使用PowerShell时,遇到下面的报错信息:无法将“Invoke-SqlCmd”项识别为 cmdlet、函数、脚本文件或可运行程序的名称。请检查名称的拼写,如果包括路径,请确保路径正确,然后重试。所在位置 行:3 字符: 38+ $list | ForEach-Object {Invoke-SqlCmd + CategoryInfo : Objec原创 2012-05-18 10:57:14 · 44164 阅读 · 1 评论 -
批量创建数据库
借助PowerShell,我们可以轻松地进行批量创建数据库,下面将详细介绍一下:比如,我们想要一次性创建3个数据库,其名称分别是DB1,DB2,DB3,我们可以建一个文本文件,如下图,文件名称是DBs,内容是要创建的数据库名称列表:接下来,我们可以使用如下的cmdlet来实现我们的目标:$list=get-content D:\DBs.txt echo $list $lis原创 2012-05-18 11:29:11 · 2456 阅读 · 0 评论 -
Automating Daily Checks with Powershell
Automating Daily Checks with PowershellBy Warren Campbell, 2011/12/19 At my company, I am required to produce evidence that I have checked every database backup on every server to ensure that转载 2012-08-24 10:52:09 · 1593 阅读 · 0 评论 -
使用PowerShell排错----PowerShell入门
PowerShell是一个面向对象、命令行、翻译 2014-07-02 21:23:00 · 5830 阅读 · 0 评论 -
使用PowerShell排错----使用PowerShell调校SQL Server性能
这里会测试一些脚本,用于SQL Server调校,如索引维护、管理翻译 2014-07-03 13:56:58 · 2197 阅读 · 0 评论 -
使用PowerShell排错----使用PowerShell调查Server问题
PowerShell与WMI框架完全集成,WMI框架翻译 2014-07-03 12:39:34 · 2348 阅读 · 0 评论 -
Managing Client Network Protocols with WMI Provider
The ClientNetworkProtocol class represents the objects for client network protocols. To see the list of protocols of ClientNetworkProtocol class:Get-WmiObject -namespace root\Microsoft\SqlServer\Com原创 2012-03-21 14:58:18 · 1177 阅读 · 0 评论 -
Managing SQL Server Services with WMI Provider
The WMI Provider for Configuration Management provides access to WMI objects in the root\Microsoft\SqlServer\ComputerManagement namespace for SQL Server 2005,and the root\Microsoft\SqlServer\ComputerM原创 2012-03-21 13:55:24 · 783 阅读 · 0 评论 -
Win32_Environment
Querying this WMI class returns environment variables found under the registry key HKLM\System\CurrentControlSet\Control\Sessionmanager\Environment. To access all the variables and their values by原创 2012-03-21 11:12:35 · 945 阅读 · 0 评论 -
File xxx.ps1 cannot be loaded because the execution of scripts is disabled on this system
When you executing PowerShell script, if PowerShell returns the below warning message:File xxx.ps1 cannot be loaded because the execution of scripts is disabled on this system. Please see "get-help原创 2011-12-16 09:46:06 · 4189 阅读 · 0 评论 -
To find all the log types available on the local or a remote computer
Excute the following command to find all the log types available on the local or a remote computer:Get-EventLog –listGet-EventLog -computerName RemoteServerName –list Query all the entries in原创 2012-03-15 15:44:15 · 591 阅读 · 0 评论 -
How to see all the application errors related to SQL Server and export them to a .csv file.
How to see all the application errors related to SQL Server and export them to a .csv file? Just use below command: Get-EventLog -LogName "Application" -computername RemoteServerName | Where-Obje原创 2012-03-15 15:05:05 · 702 阅读 · 0 评论 -
The WMI Model
¤The WMI model has three layers:The lowest layer in the WMI model is managed resource. Windows resources that can be managed using WMI include event logs, services, processes, environment variables,原创 2012-03-16 16:20:48 · 777 阅读 · 0 评论 -
Windows PowerShell and Processes
All the available cmdlets related to processes can be found by executing the following cmdlet:Get-Command *process* -CommandType "cmdlet" Get-ProcessTo get a list of processes running on the l原创 2012-03-16 13:10:12 · 730 阅读 · 0 评论 -
Windows PowerShell and Services
To find all the cmdlets that are related to Windows services, execute the following command:Get-Command -CommandType cmdlet *service* Get-ServiceTo find all the running services that start wit原创 2012-03-16 11:11:57 · 1212 阅读 · 0 评论 -
Permission Issues and WMI
In order for WMI to work, the Windows Management Instrumentation service must be running.The service cannot be disabled and it must run under the local system account. If this account is changed, WMI原创 2012-03-16 14:09:40 · 727 阅读 · 0 评论 -
PowerShell cmdlets Related to event log
The most commonly used cmdlets related to event logging are as follows:Get-EventLogClear-EventLogShow-EventLogLimit-EventLogWrite-EventLogNew-EventLogRemove-EventLog clear the events原创 2012-03-15 16:35:03 · 990 阅读 · 0 评论 -
Win32_NTEventlogFile
To get a list of log files available on your local computer:Get-WmiObject -class Win32_NTEventlogFile | Format-Table –wrap To access the log files on a remote computer:Get-WmiObject -computerN原创 2012-03-19 15:42:21 · 2553 阅读 · 0 评论 -
Win32_Service
To get a list of services on the local or remote computer:Get-WmiObject -class Win32_ServiceGet-WmiObject –computerName RemoteHostName-class Win32_Service To get the SQL Server service of the原创 2012-03-20 10:37:51 · 2307 阅读 · 0 评论 -
Win32_Process
To get a list of processes on your local computer:Get-WmiObject -class Win32_Process To get the values of related properties for the process sqlservr.exe, the SQL Server service:Get-WmiObject原创 2012-03-20 13:07:59 · 3400 阅读 · 0 评论 -
StdRegProv
The StdRegProv class contains methods that manipulate system registry keys and values.To check all the methods that are available from the class StdRegProv:$Reg = [WMIClass]"root\default:stdRegPro原创 2012-03-21 12:09:48 · 1342 阅读 · 0 评论 -
使用PowerShell发送带附件的Email
该脚本使用Exchange插件发送mail。打开Powershell ISE,复制下面的脚本并添加正确的email地址即可。ClearAdd-PSSnapin Microsoft.Exchange.Management.Powershell.Admin -erroraction silentlyContinuefunction sendmail_withAttachment {P原创 2016-08-10 15:32:49 · 6618 阅读 · 0 评论