$account = New-Object System.Security.Principal.NTAccount "<domain>\<username>" $account.Translate([System.Security.Principal.SecurityIdentifier]).Value 对以下文件系统文件夹的读取权限: %ProgramFiles%\Microsoft Forefront
Method void CancelErrorRead() CancelOutputRead Method void CancelOutputRead() Close Method void Close() CloseMainWindow Method bool CloseMainWindow() CreateObjRef Method System.Runtime.Remoting.ObjRef ... Dispose Method void Dispose(), void IDisposabl... Equals Method bool Equals(System.Object obj) ...
PowerShell和C#的string类型是直接继承自System.Object类,因此说string类型并非是简单类型(值类型),而是一种引用类型(如果有过C#的开发经验应该知道继承自ValueType类的类型运行时在栈里创建对象,而直接继承自Object的是在堆中创建对象)。 PowerShell的转义字符是 ` 而不是 \,这也是和C#的一个区别 #使用charPSD:/...
对于该处理器系列的常规描述字符串,可以仅返回SystemType属性: PowerShell Get-CimInstance-ClassNameWin32_ComputerSystem |Select-Object-PropertySystemType SystemType --- X86-based PC 列出计算机制造商和型号 Win32_ComputerSystem中也提供了计算机型号信息。 标准显示输出不需要任何筛选便可提供 OEM 数据: PowerShel...
它使用Select-Objectcmdlet 输出[System.Diagnostics.ProcessModule]实例数组,如每个System.Diagnostics.Process实例输出的Get-Process属性中包含的。 cmdlet 的Select-Object参数选择进程名称。 这会向每个ProcessName实例添加一个[System.Diagnostics.ProcessModule],并使用当前进程的processName属性的值填充它。
$P=Get-ProcessWrite-Output$P 示例2:将输出传递给另一个 cmdlet 此命令通过管道将“测试输出”字符串传递给Get-Membercmdlet,该 cmdlet 显示System.String类的成员,演示了字符串成功通过管道传递。 PowerShell Write-Output"test output"|Get-Member 示例3:取消输出中的枚举 ...
System.String You can pipe a string that contains the name of a service to this cmdlet. OUTPUTS None By default, this cmdlet returns no output. System.ServiceProcess.ServiceController When you use the PassThru parameter, this cmdlet returns a ServiceController object representing the service. ......
$cs=Get-WmiObject -Class win32_computersystem -ErrorAction Stop }catch{ $computer |out-file c:\temp\error.txt -Append } $prop=@{ComputerName=$computer;LastBootTime=$os.ConvertToDateTime($os.LastBootUpTime);OSVersion=$os.Version;Manufacture=$cs.Manufacturer;Model=$cs.model} ...
此示例演示当你不在 FileSystem 提供程序驱动器中操作时如何使用Out-Filecmdlet。 使用Get-PSProvidercmdlet 查看本地计算机上的提供程序。 有关详细信息,请参阅about_Providers。 PowerShell PS>Set-Location-PathAlias: PS>Get-LocationPath --- Alias:\ PS>Get-ChildItem|Out-File-FilePathC:\TestDir\AliasName...
systemlog1.log Get-ChildItem -Path C:\Test\Logs\* -Exclude A* Directory: C:\Test\Logs Mode LastWriteTime Length Name --- --- --- --- d--- 2/15/2019 13:21 Backup -a--- 2/13/2019 13:26 20 LogFile1.txt -a--- 2/12/2019 16:24 23 systemlog1.log Get-ChildItem cmdlet 使...