This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if($computerName) { | |
return Get-WMIObject -ComputerName $siteProvider -Namespace "root\sms\site_$siteCode" -class "SMS_R_System" -filter "Name LIKE `"%$ComputerName%`"" | |
} elseif($resourceId) { | |
return Get-WMIObject -ComputerName $siteProvider -Namespace "root\sms\site_$siteCode" -Class "SMS_R_System" -filter "ResourceID=$resourceId" | |
} else { | |
return Get-WMIObject -ComputerName $siteProvider -Namespace "root\sms\site_$siteCode" -Class "SMS_R_System" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# In the module we have the following query | |
# (I had Backtick to fit in my blog, don't do this at home! ;-) ) | |
$computer = Get-WMIObject ` | |
-ComputerName $siteProvider ` | |
-Namespace "root\sms\site_$siteCode" ` | |
-Class "SMS_R_System" | Where { $_.ResourceID -eq $resourceId } | |
# Let's measure our command on a big environment (+6000 computers) | |
# Note that I replaced some values, you need to specify the SiteProvider, SiteCode and | |
# ResourceID. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Let's measure our command on a big environment (+6000 computers) with some filtering | |
# Note that I replaced some values, you need to specify the SiteProvider, SiteCode and | |
# ResourceID. | |
Measure-Command {Get-WMIObject` | |
-ComputerName <SiteProvider> ` | |
-Namespace "root\sms\site_<SITECODE>" ` | |
-Query "Select * From SMS_R_System WHERE ResourceID='<ResourceID>'"} | |
Days : 0 | |
Hours : 0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#requires -Version 3.0 | |
#requires -PSSnapin VMware.VimAutomation.Core | |
function Enable-VMCopyPaste | |
{ | |
[CmdletBinding()] | |
PARAM( | |
[string[]]$vm | |
) | |
BEGIN{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#requires -Version 3.0 | |
#requires -PSSnapin VMware.VimAutomation.Core | |
function Disable-VMCopyPaste | |
{ | |
[CmdletBinding()] | |
PARAM( | |
[string[]]$vm | |
) | |
BEGIN{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#http://www.lazywinadmin.com/2013/10/powershell-get-domainuser.html | |
function Get-DomainUser { | |
PARAM($DisplayName) | |
$Search = [adsisearcher]"(&(objectCategory=person)(objectClass=User)(displayname=$DisplayName))" | |
foreach ($user in $($Search.FindAll())){ | |
New-Object -TypeName PSObject -Property @{ | |
"DisplayName" = $user.properties.displayname -as [string] | |
"UserName" = $user.properties.samaccountname -as [string] | |
"Description" = $user.properties.description -as [string] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#http://www.lazywinadmin.com/2013/10/powershell-get-domainuser.html | |
function Get-DomainUser { | |
PARAM($DisplayName) | |
$Search = [adsisearcher]"(&(objectCategory=person)(objectClass=User)(displayname=$DisplayName))" | |
foreach ($user in $($Search.FindAll())){ | |
New-Object -TypeName PSObject -Property @{ | |
"DisplayName" = $user.properties.displayname -as [string] | |
"UserName" = $user.properties.samaccountname -as [string] | |
"Description" = $user.properties.description -as [string] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Get-DomainUser | |
{ | |
PARAM ($DisplayName,[Adsi]$SearchRoot= "LDAP://OU=Servers,OU=TEST,dc=fx,dc=lab") | |
$Search = [adsisearcher]"(&(objectCategory=person)(objectClass=User)(displayname=$DisplayName))" | |
$Search.searchRoot = $SearchRoot | |
foreach ($user in $($Search.FindAll())) | |
{ | |
New-Object -TypeName PSObject -Property @{ | |
"DisplayName" = $user.properties.displayname -as [string] | |
"UserName" = $user.properties.samaccountname -as [string] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Get-NestedMember | |
{ | |
<# | |
.SYNOPSIS | |
Find all Nested members of a group | |
.DESCRIPTION | |
Find all Nested members of a group | |
.PARAMETER GroupName | |
Specify one or more GroupName to audit | |
.Example |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#------------------------------------------------------------------------ | |
# Source File Information (DO NOT MODIFY) | |
# Source ID: 7cc35deb-97f1-4821-9fac-1339de8a644c | |
# Source File: C:\Users\Francois-Xavier\SkyDrive\Scripts\PowerShell\GitHub\PowerShellGUI\_Examples_Winforms\ClipBoard_Paste.psf | |
#------------------------------------------------------------------------ | |
<# | |
.NOTES | |
-------------------------------------------------------------------------------- | |
Code generated by: SAPIEN Technologies, Inc., PowerShell Studio 2014 v4.1.71 |
OlderNewer