full_path
stringlengths
31
232
filename
stringlengths
4
167
content
stringlengths
0
48.3M
PowerShellCorpus/Github/lazywinadmin_PowerShell/_Profiles/functions/Get-UsefulNetMethod.ps1
Get-UsefulNetMethod.ps1
Write-Host "[Math]::Round(7.9)" Write-Host "[Convert]::ToString(576255753217, 8)" Write-Host "[Guid]::NewGuid()" Write-Host "[Net.Dns]::GetHostByName('schulung12')" Write-Host "[IO.Path]::GetExtension('c:\test.txt')" Write-Host "[IO.Path]::ChangeExtension('c:\test.txt', 'bak')"
PowerShellCorpus/Github/lazywinadmin_PowerShell/_Profiles/functions/Test-DatePattern.ps1
Test-DatePattern.ps1
function Test-DatePattern { #http://jdhitsolutions.com/blog/2014/10/powershell-dates-times-and-formats/ $patterns = "d","D","g","G","f","F","m","o","r","s", "t","T","u","U","Y","dd","MM","yyyy","yy","hh","mm","ss","yyyyMMdd","yyyyMMddhhmm","yyyyMMddhhmmss" Write-host "It is now $(Get-Date)" -ForegroundColor Green...
PowerShellCorpus/Github/lazywinadmin_PowerShell/_Profiles/functions/show-object.ps1
show-object.ps1
############################################################################# ## ## Show-Object ## ## From Windows PowerShell Cookbook (O'Reilly) ## by Lee Holmes (http://www.leeholmes.com/guide) ## ############################################################################## function show-object { <# .SY...
PowerShellCorpus/Github/lazywinadmin_PowerShell/_Profiles/functions/View-Cats.ps1
View-Cats.ps1
function View-Cats { <# .SYNOPSIS This will open Internet explorer and show a different cat every 5 seconds .DESCRIPTION .NOTES #http://www.reddit.com/r/PowerShell/comments/2htfog/viewcats/ #> Param( [int]$refreshtime=5 ) $IE = new-object -ComObject internetexplorer.application ...
PowerShellCorpus/Github/lazywinadmin_PowerShell/_Template/Function_Template.ps1
Function_Template.ps1
Function Get-Something { <# .SYNOPSIS A brief description of the Get-Something function. .DESCRIPTION A detailed description of the Get-Something function. .PARAMETER ComputerName A description of the ComputerName parameter. .PARAMETER Credential A description of the Credential parameter....
PowerShellCorpus/Github/lazywinadmin_PowerShell/SCSM-MA-Set-SCSMMAStatus/SCSM-MA-Set-SCSMMAStatus.ps1
SCSM-MA-Set-SCSMMAStatus.ps1
Function Set-SCSMMAStatus { [CmdletBinding()] PARAM( $ManualActivityID, $Status = "Completed" ) BEGIN { TRY { if (-not(Get-module -Name smlets)) { # Import the module Import-Module -Name smlets ...
PowerShellCorpus/Github/lazywinadmin_PowerShell/O365-Update-O365UserUPNSuffix/Update-O365UserUPNSuffix.ps1
Update-O365UserUPNSuffix.ps1
function Update-O365UserUPNSuffix { <# .SYNOPSIS Function to correct the UPN of a user in Office365 (O365) and Active Directory (AD) .DESCRIPTION Function to correct the UPN of a user in Office365 (O365) and Active Directory (AD). Once modified you might want to force the sync between AD and O365 to m...
PowerShellCorpus/Github/lazywinadmin_PowerShell/TOOL-Invoke-Ping/Invoke-Ping.ps1
Invoke-Ping.ps1
Function Invoke-Ping { <# .SYNOPSIS Ping or test connectivity to systems in parallel .DESCRIPTION Ping or test connectivity to systems in parallel Default action will run a ping against systems If Quiet parameter is specified, we return an array of systems that responded If ...
PowerShellCorpus/Github/lazywinadmin_PowerShell/TOOL-Set-RDPEnable/Set-RDPEnable.ps1
Set-RDPEnable.ps1
function Set-RDPEnable { <# .SYNOPSIS The function Set-RDPEnable enable RDP remotely using the registry .DESCRIPTION The function Set-RDPEnable enable RDP remotely using the registry .PARAMETER ComputerName Specifies the ComputerName .EXAMPLE PS C:\> Set-RDPEnable .EXAMPLE PS C:\>...
PowerShellCorpus/Github/lazywinadmin_PowerShell/SCCM-Remove-SCCMUserDeviceAffinity/Remove-SCCMUserDeviceAffinity.ps1
Remove-SCCMUserDeviceAffinity.ps1
function Remove-SCCMUserDeviceAffinity { <# .SYNOPSIS Function to remove the primary user(s) or group(s) from a device in SCCM .DESCRIPTION Function to remove the primary user(s) or group(s) from a device in SCCM .PARAMETER SiteCode Specifies the SCCM Site Code .PARAMETER SiteServer Speci...
PowerShellCorpus/Github/lazywinadmin_PowerShell/TOOL-Get-HashTableNotEmptyValue/Get-HashTableNotEmptyValue.ps1
Get-HashTableNotEmptyValue.ps1
Function Get-HashTableNotEmptyOrNullValue { <# .SYNOPSIS This function will get the values that are not empty or Null in a hashtable object .DESCRIPTION This function will get the values that are not empty or Null in a hashtable object .PARAMETER Hashtable Specifies the hashtable that will be showed...
PowerShellCorpus/Github/lazywinadmin_PowerShell/TOOL-ConvertTo-Base64/ConvertTo-Base64.ps1
ConvertTo-Base64.ps1
function ConvertTo-Base64 { <# .SYNOPSIS Function to convert an image to Base64 .DESCRIPTION Function to convert an image to Base64 .PARAMETER Path Specifies the path of the file .EXAMPLE ConvertTo-Base64 -Path "C:\images\PowerShellLogo.png" .NOTES Francois-Xavier Cat @lazywina...
PowerShellCorpus/Github/lazywinadmin_PowerShell/TOOL-Test-IsLocalAdministrator/Test-IsLocalAdministrator.ps1
Test-IsLocalAdministrator.ps1
function Test-IsLocalAdministrator { <# .SYNOPSIS Function to verify if the current user is a local Administrator on the current system .DESCRIPTION Function to verify if the current user is a local Administrator on the current system .EXAMPLE Test-IsLocalAdministrator True .NOTES Francois-Xavier Cat ...
PowerShellCorpus/Github/lazywinadmin_PowerShell/AD-SITE-Get_Site_and_Subnets/Get-ADSiteAndSubnet.ps1
Get-ADSiteAndSubnet.ps1
function Get-ADSiteAndSubnet { <# .SYNOPSIS This function will retrieve Site names, subnets names and descriptions. .DESCRIPTION This function will retrieve Site names, subnets names and descriptions. .EXAMPLE Get-ADSiteAndSubnet .EXAMPLE Get-ADSiteAndSubnet | Export-Csv -Path .\ADSiteInvent...
PowerShellCorpus/Github/lazywinadmin_PowerShell/TOOL-Get-NetStat/Get-NetStat.ps1
Get-NetStat.ps1
function Get-NetStat { <# .SYNOPSIS This function will get the output of netstat -n and parse the output .DESCRIPTION This function will get the output of netstat -n and parse the output .LINK http://www.lazywinadmin.com/2014/08/powershell-parse-this-netstatexe.html .NOTES Francois-Xavier Cat www.lazywi...
PowerShellCorpus/Github/lazywinadmin_PowerShell/O365-Connect-Office365/Connect-Office365.ps1
Connect-Office365.ps1
function Connect-Office365 { <# .SYNOPSIS This function will prompt for credentials, load module MSOLservice, load implicit modules for Office 365 Services (AD, Lync, Exchange) using PSSession. .DESCRIPTION This function will prompt for credentials, load module MSOLservice, load implicit modules for O...
PowerShellCorpus/Github/lazywinadmin_PowerShell/TOOL-Send-Email/TOOL-Send-Email.ps1
TOOL-Send-Email.ps1
function Send-Email { <# .SYNOPSIS This function allows you to send email .DESCRIPTION This function allows you to send email using the NET Class System.Net.Mail .PARAMETER To A description of the To parameter. .PARAMETER From A description of the From parameter. .PARAMETER FromDispl...
PowerShellCorpus/Github/lazywinadmin_PowerShell/TOOL-Disable-RemoteDesktop/Disable-RemoteDesktop.ps1
Disable-RemoteDesktop.ps1
function Disable-RemoteDesktop { <# .SYNOPSIS The function Disable-RemoteDesktop will disable RemoteDesktop on a local or remote machine. .DESCRIPTION The function Disable-RemoteDesktop will disable RemoteDesktop on a local or remote machine. .PARAMETER ComputerName Specifies the computername ...
PowerShellCorpus/Github/lazywinadmin_PowerShell/AD-GROUP-Get-NestedMember/AD-GROUP-Get-NestedMember.ps1
AD-GROUP-Get-NestedMember.ps1
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 Get-NestedMember -GroupName TESTGROUP This will find all t...
PowerShellCorpus/Github/lazywinadmin_PowerShell/TOOL-Get-LocalUser/Get-LocalUser.ps1
Get-LocalUser.ps1
function Get-LocalUser { <# .SYNOPSIS This script can be list all of local user account. .DESCRIPTION This script can be list all of local user account. The function is using WMI to connect to the remote machine .PARAMETER ComputerName Specifies the computers on which the command . The defa...
PowerShellCorpus/Github/lazywinadmin_PowerShell/SCSM-SR-Add-SCSMSRComment/Add-SCSMSRComment.ps1
Add-SCSMSRComment.ps1
Function Add-SRComment { <# .SYNOPSIS Function to add a comment inside a Service Request .DESCRIPTION Function to add a comment inside a Service Request You need to have SMlets installed and permission to write inside the service request. .PARAMETER ServiceRequestObject Specifies the Servic...
PowerShellCorpus/Github/lazywinadmin_PowerShell/SCSM-Get-SCSMWorkItemCreatedByUser/Get-SCSMWorkItemCreatedByUser.ps1
Get-SCSMWorkItemCreatedByUser.ps1
function Get-SCSMWorkItemCreatedByUser { <# .SYNOPSIS Function to retrieve the Created By User of a Work Item .DESCRIPTION Function to retrieve the Created By User of a Work Item .PARAMETER SMObject Specifies the SMObject(s) on which the Created By need to be retrieve. .PARAMETER Guid Spe...
PowerShellCorpus/Github/lazywinadmin_PowerShell/TOOL-Remove-StringSpecialCharacter/Remove-StringSpecialCharacter.ps1
Remove-StringSpecialCharacter.ps1
function Remove-StringSpecialCharacter { <# .SYNOPSIS This function will remove the special character from a string. .DESCRIPTION This function will remove the special character from a string. I'm using Unicode Regular Expressions with the following categories \p{L} : any kind of letter from any language...
PowerShellCorpus/Github/lazywinadmin_PowerShell/TOOL-Enable-RemoteDesktop/Enable-RemoteDesktop.ps1
Enable-RemoteDesktop.ps1
function Enable-RemoteDesktop { <# .SYNOPSIS The function Enable-RemoteDesktop will enable RemoteDesktop on a local or remote machine. .DESCRIPTION The function Enable-RemoteDesktop will enable RemoteDesktop on a local or remote machine. .PARAMETER ComputerName Specifies the computername .PA...
PowerShellCorpus/Github/lazywinadmin_PowerShell/AD-USER-Get-ADDirectReport/Get-ADDirectReport.ps1
Get-ADDirectReport.ps1
function Get-ADDirectReports { <# .SYNOPSIS This function retrieve the directreports property from the IdentitySpecified. Optionally you can specify the Recurse parameter to find all the indirect users reporting to the specify account (Identity). .DESCRIPTION This function retrieve the directrepor...
PowerShellCorpus/Github/lazywinadmin_PowerShell/TOOL-Set-RDPDisable/Set-RDPDisable.ps1
Set-RDPDisable.ps1
function Set-RDPDisable { <# .SYNOPSIS The function Set-RDPDisable disable RDP remotely using the registry .DESCRIPTION The function Set-RDPDisable disable RDP remotely using the registry .PARAMETER ComputerName Specifies the ComputerName .EXAMPLE PS C:\> Set-RDPDisable .EXAMPLE P...
PowerShellCorpus/Github/lazywinadmin_PowerShell/SCSM-Get-SCSMIncidentRequestComment/Get-SCSMIncidentRequestComment.ps1
Get-SCSMIncidentRequestComment.ps1
function Get-SCSMIncidentRequestComment { <# .SYNOPSIS Function to retrieve the comments from a Incident Request WorkItem .DESCRIPTION Function to retrieve the comments from a Incident Request WorkItem .PARAMETER DateTime Specifies from when (DateTime) the search need to look .PARAMETER GUID...
PowerShellCorpus/Github/lazywinadmin_PowerShell/TOOL-Get-NetFrameworkTypeAccelerator/Get-NetFrameworkTypeAccelerator.ps1
Get-NetFrameworkTypeAccelerator.ps1
function Get-NetFrameworkTypeAccelerator { <# .SYNOPSIS Function to retrieve the list of Type Accelerator available .EXAMPLE Get-NetFrameworkTypeAccelerator Return the list of Type Accelerator available on your system .EXAMPLE Get-Accelerator Return the list of Type Accelerator available on your s...
PowerShellCorpus/Github/lazywinadmin_PowerShell/TOOL-Remove-StringLatinCharacter/Remove-StringLatinCharacter.ps1
Remove-StringLatinCharacter.ps1
function Remove-StringLatinCharacter { <# .SYNOPSIS Function to remove diacritics from a string .PARAMETER String Specifies the String that will be processed .EXAMPLE Remove-StringLatinCharacter -String "L'été de Raphaël" L'ete de Raphael .EXAMPLE Foreach ($file in (Get-ChildItem c:\test\*...
PowerShellCorpus/Github/lazywinadmin_PowerShell/TOOL-Get-NetworkLevelAuthentication/Get-NetworkLevelAuthentication.ps1
Get-NetworkLevelAuthentication.ps1
function Get-NetworkLevelAuthentication { <# .SYNOPSIS This function will get the NLA setting on a local machine or remote machine .DESCRIPTION This function will get the NLA setting on a local machine or remote machine .PARAMETER ComputerName Specify one or more computer to query .PARAMETER Credent...
PowerShellCorpus/Github/lazywinadmin_PowerShell/SCSM-Get-SCSMWorkItemRelatedCI/Get-SCSMWorkItemRelatedCI.ps1
Get-SCSMWorkItemRelatedCI.ps1
function Get-SCSMWorkItemRelatedCI { <# .SYNOPSIS Function to retrieve the related configuration item of a System Center Service Manager Work Item .DESCRIPTION Function to retrieve the related configuration item of a System Center Service Manager Work Item .PARAMETER GUID Specifies the GUID of th...
PowerShellCorpus/Github/lazywinadmin_PowerShell/TOOL-Set-PowerShellWindowTitle/Set-PowerShellWindowTitle.ps1
Set-PowerShellWindowTitle.ps1
function Set-PowerShellWindowTitle { <# .SYNOPSIS Function to set the title of the PowerShell Window .DESCRIPTION Function to set the title of the PowerShell Window .PARAMETER Title Specifies the Title of the PowerShell Window .EXAMPLE PS C:\> Set-PowerShellWindowTitle -Title LazyWinAdmin...
PowerShellCorpus/Github/lazywinadmin_PowerShell/AD-GPO-Get-ADGPOReplication/AD-GPO-Get-ADGPOReplication.ps1
AD-GPO-Get-ADGPOReplication.ps1
function Get-ADGPOReplication { <# .SYNOPSIS This function retrieve one or all the GPO and report their DSVersions and SysVolVersions (Users and Computers) .DESCRIPTION This function retrieve one or all the GPO and report their DSVersions and SysVolVersions (Users and Computers) .PARAMETER GPOName Spe...
PowerShellCorpus/Github/lazywinadmin_PowerShell/AD-FSMO-Get-ADFSMORole/AD-FSMO-Get-ADFSMORole.ps1
AD-FSMO-Get-ADFSMORole.ps1
function Get-ADFSMORole { <# .SYNOPSIS Retrieve the FSMO Role in the Forest/Domain. .DESCRIPTION Retrieve the FSMO Role in the Forest/Domain. .EXAMPLE Get-ADFSMORole .EXAMPLE Get-ADFSMORole -Credential (Get-Credential -Credential "CONTOSO\SuperAdmin") .NOTES Francois-Xavier Cat ...
PowerShellCorpus/Github/lazywinadmin_PowerShell/EXCHANGE-Connect-ExchangeOnPremises/Connect-ExchangeOnPremises.ps1
Connect-ExchangeOnPremises.ps1
function Connect-ExchangeOnPremises { <# .SYNOPSIS Function to Connect to an Exchange OnPremises environment .DESCRIPTION Function to Connect to an Exchange OnPremises environment .PARAMETER ConnectionUri Specifies the Connection Uri to use Example: http://ExchServer.lazywinadmin.com/powershel...
PowerShellCorpus/Github/lazywinadmin_PowerShell/SCSM-Get-SCSMServiceRequestComment/Get-SCSMServiceRequestComment.ps1
Get-SCSMServiceRequestComment.ps1
function Get-SCSMServiceRequestComment { <# .SYNOPSIS Function to retrieve the comments from a Service Request WorkItem .DESCRIPTION Function to retrieve the comments from a Service Request WorkItem .PARAMETER DateTime Specifies from when (DateTime) the search need to look .PARAMETER GUID ...
PowerShellCorpus/Github/lazywinadmin_PowerShell/SCCM-Get-SCCMUserCollectionDeployment/Get-SCCMUserCollectionDeployment.ps1
Get-SCCMUserCollectionDeployment.ps1
function Get-SCCMUserCollectionDeployment { <# .SYNOPSIS Function to retrieve a User's collection deployment .DESCRIPTION Function to retrieve a User's collection deployment The function will first retrieve all the collection where the user is member of and find deployments advertised on those. ...
PowerShellCorpus/Github/lazywinadmin_PowerShell/SCCM-Set-SCCMClientCacheSize/Set-SCCMClientCacheSize.ps1
Set-SCCMClientCacheSize.ps1
function Set-SCCMClientCacheSize { <# .SYNOPSYS Function to set the cache size on a SCCM Client .DESCRIPTION Function to set the cache size on a SCCM Client .PARAMETER ComputerName Specifies the name of the client on which the Cache size need to be changed .PARAMETER SizeMB Specifies the ...
PowerShellCorpus/Github/lazywinadmin_PowerShell/_Test/Add-LocalGroupMember.ps1
Add-LocalGroupMember.ps1
Function Add-LocalGroupMember { <# .SYNOPSIS .DESCRIPTION .PARAMETER .EXAMPLE .NOTES Add support for local user/group and ad user/group New-ADGroup -Name "AdmServer$env:COMPUTERNAME" -GroupScope Global -GroupCategory Security -Path $ouPath $fqdn = $_.DNSRoot ([adsi]"WinNT://./Administrat...
PowerShellCorpus/Github/lazywinadmin_PowerShell/_Test/AD-TokenGroups_Test.ps1
AD-TokenGroups_Test.ps1
$UserSam = "TestAccount" $Search = New-Object -TypeName System.DirectoryServices.DirectorySearcher -ErrorAction 'Stop' $Search.Filter = "(&((objectclass=user)(samaccountname=$UserSam)))" $Search.FindAll() | ForEach-Object -Process { $Account = $_ $AccountGetDirectory = $Account.GetDirectoryEn...
PowerShellCorpus/Github/lazywinadmin_PowerShell/SCSM-Add-SCSMServiceRequestComment/Add-SCSMServiceRequestComment.ps1
Add-SCSMServiceRequestComment.ps1
Function Add-SCSMServiceRequestComment { param ( [parameter(Mandatory = $True, Position = 0)] $SRObject, [parameter(Mandatory = $True, Position = 1)] $Comment, [parameter(Mandatory = $True, Position = 2)] $EnteredBy, [parameter(Mandatory = $False, Position = 3)] [switch]$AnalystCo...
PowerShellCorpus/Github/lazywinadmin_PowerShell/TOOL-Get-LocalGroupMember/Get-LocalGroupMember.ps1
Get-LocalGroupMember.ps1
function Get-LocalGroupMember { <# .SYNOPSIS Retrieve a Local Group membership .DESCRIPTION Retrieve a Local Group membership .PARAMETER ComputerName Specifies one or computers to query .PARAMETER GroupName Specifies the Group name .EXAMPLE Get-LocalGroupMember .N...
PowerShellCorpus/Github/lazywinadmin_PowerShell/TOOL-New-ScriptMessage/New-ScriptMessage.ps1
New-ScriptMessage.ps1
function New-ScriptMessage { <# .SYNOPSIS Helper Function to show default message used in VERBOSE/DEBUG/WARNING .DESCRIPTION Helper Function to show default message used in VERBOSE/DEBUG/WARNING and... HOST in some case. This is helpful to standardize the output messages .PARAMETER Message ...
PowerShellCorpus/Github/lazywinadmin_PowerShell/AD-GROUP-Monitor_MemberShip/AD-GROUP-Monitor_MemberShip.ps1
AD-GROUP-Monitor_MemberShip.ps1
<# .SYNOPSIS This script is monitoring group(s) in Active Directory and send an email when someone is changing the membership. .DESCRIPTION This script is monitoring group(s) in Active Directory and send an email when someone is changing the membership. It will also report the Change History made for this/tho...
PowerShellCorpus/Github/lazywinadmin_PowerShell/TOOL-Clean-MacAddress/Clean-MacAddress.ps1
Clean-MacAddress.ps1
function Clean-MacAddress { <# .SYNOPSIS Function to cleanup a MACAddress string .DESCRIPTION Function to cleanup a MACAddress string .PARAMETER MacAddress Specifies the MacAddress .PARAMETER Separator Specifies the separator every two characters .PARAMETER Uppercase Specifies the...
PowerShellCorpus/Github/lazywinadmin_PowerShell/TOOL-Get-PendingReboot/Get-PendingReboot.ps1
Get-PendingReboot.ps1
Function Get-PendingReboot { <# .SYNOPSIS Gets the pending reboot status on a local or remote computer. .DESCRIPTION This function will query the registry on a local or remote computer and determine if the system is pending a reboot, from either Microsoft Patching or a Software Installation. ...
PowerShellCorpus/Github/lazywinadmin_PowerShell/TOOL-Get-StringLastDigit/Get-StringLastDigit.ps1
Get-StringLastDigit.ps1
function Get-StringLastDigit { <# .SYNOPSIS Get the last digit of a string .DESCRIPTION Get the last digit of a string using Regular Expression .PARAMETER String Specifies the String to check .EXAMPLE PS C:\> Get-StringLastDigit -String "Francois-Xavier.cat5" ...
PowerShellCorpus/Github/lazywinadmin_PowerShell/O365-Get-O365CalendarEvent/O365-Get-O365CalendarEvent.ps1
O365-Get-O365CalendarEvent.ps1
function Get-O365CalendarEvent { <# .SYNOPSIS Function to gather Calendar Events between two specific dates .DESCRIPTION Function to gather Calendar Events between two specific dates It is using the REST API available against Office365 .PARAMETER EmailAddress Specifies the mailbox email address to qu...
PowerShellCorpus/Github/lazywinadmin_PowerShell/AD-SITE-Get-ADSiteInventory/Get-ADSiteInventory.ps1
Get-ADSiteInventory.ps1
function Get-ADSiteInventory { <# .SYNOPSIS This function will retrieve information about the Sites and Services of the Active Directory .DESCRIPTION This function will retrieve information about the Sites and Services of the Active Directory .EXAMPLE Get-ADSiteInventory .EXAMPLE Get-ADSiteI...
PowerShellCorpus/Github/lazywinadmin_PowerShell/TOOL-Get-ProcessForeignAddress/Get-ProcessForeignAddress.ps1
Get-ProcessForeignAddress.ps1
function Get-ProcessForeignAddress { <# .SYNOPSIS Get all foreignIPAddress for all or specific processname .DESCRIPTION Get all foreignIPAddress for all or specific processname .PARAMETER ProcessName Specifies the ProcessName to filter on .EXAMPLE Get-ProcessForeignAddress Retrieve all the f...
PowerShellCorpus/Github/lazywinadmin_PowerShell/AD-GROUP-Get-ParentGroup/AD-GROUP-Get-ParentGroup.ps1
AD-GROUP-Get-ParentGroup.ps1
function Get-ParentGroup { <# .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 Get-NestedMember -GroupName TESTGROUP This will find all th...
PowerShellCorpus/Github/lazywinadmin_PowerShell/TOOL-Get-PSObjectEmptyOrNullProperty/Get-PSObjectEmptyOrNullProperty.ps1
Get-PSObjectEmptyOrNullProperty.ps1
function Get-PSObjectEmptyOrNullProperty { <# .SYNOPSIS Function to Get all the empty or null properties with empty value in a PowerShell Object .DESCRIPTION Function to Get all the empty or null properties with empty value in a PowerShell Object. I used this function in a System Center Orchestrator where ...
PowerShellCorpus/Github/lazywinadmin_PowerShell/EXCHANGE-Connect-ExchangeOnline/Connect-ExchangeOnline.ps1
Connect-ExchangeOnline.ps1
function Connect-ExchangeOnline { <# .SYNOPSIS Function to Connect to an Exchange Online .DESCRIPTION Function to Connect to an Exchange Online .PARAMETER ConnectionUri Specifies the Connection Uri to use Default is https://ps.outlook.com/powershell/ .PARAMETER Credential Specifies the...
PowerShellCorpus/Github/lazywinadmin_PowerShell/SCSM-Get-SCSMWorkItemParent/Get-SCSMWorkItemParent.ps1
Get-SCSMWorkItemParent.ps1
function Get-SCSMWorkItemParent { <# .DESCRIPTION Function to retrieve the parent of a System Center Service Manager Work Item .SYNOPSIS Function to retrieve the parent of a System Center Service Manager Work Item .PARAMETER WorkItemGUI Specified the GUID of the Work Item .PARAMETER WorkIte...
PowerShellCorpus/Github/lazywinadmin_PowerShell/TOOL-Remove-PSObjectEmptyOrNullProperty/Remove-PSObjectEmptyOrNullProperty.ps1
Remove-PSObjectEmptyOrNullProperty.ps1
function Remove-PSObjectEmptyOrNullProperty { <# .SYNOPSIS Function to Remove all the empty or null properties with empty value in a PowerShell Object .DESCRIPTION Function to Remove all the empty or null properties with empty value in a PowerShell Object .PARAMETER PSObject Specifies the PowerSh...
PowerShellCorpus/Github/lazywinadmin_PowerShell/TOOL-Resolve-ShortURL/Resolve-ShortURL.ps1
Resolve-ShortURL.ps1
function Resolve-ShortURL { <# .SYNOPSIS Function to resolve a short URL to the absolute URI .DESCRIPTION Function to resolve a short URL to the absolute URI .PARAMETER ShortUrl Specifies the ShortURL .EXAMPLE Resolve-ShortURL -ShortUrl http://goo.gl/P5PKq .EXAMPLE Resolve-ShortURL -ShortUrl ht...
PowerShellCorpus/Github/lazywinadmin_PowerShell/TOOL-Start-KeyLogger/Start-KeyLogger.ps1
Start-KeyLogger.ps1
#requires -Version 2 function Start-KeyLogger($Path = "$env:temp\keylogger.txt") { <# .DESCRIPTION By accessing the Windows low-level API functions, a script can constantly monitor the keyboard for keypresses and log these to a file. This effectively produces a keylogger. Run the function Start-Keylog...
PowerShellCorpus/Github/lazywinadmin_PowerShell/SCSM-Get-SCSMWorkItemAffectedCI/Get-SCSMWorkItemAffectedCI.ps1
Get-SCSMWorkItemAffectedCI.ps1
function Get-SCSMWorkItemAffectedCI { <# .SYNOPSIS Function to retrieve the affected configuration item of a System Center Service Manager Work Item .DESCRIPTION Function to retrieve the affected configuration item of a System Center Service Manager Work Item .PARAMETER GUID Specifies the GUID of...
PowerShellCorpus/Github/lazywinadmin_PowerShell/TOOL-Get-ScriptAlias/Get-ScriptAlias.ps1
Get-ScriptAlias.ps1
function Get-ScriptAlias { <# .SYNOPSIS Function to retrieve the aliases inside a Powershell script file. .DESCRIPTION Function to retrieve the aliases inside a Powershell script file. Using PowerShell AST Parser we are able to retrieve the functions and cmdlets used in the script. .PARAMETER Pat...
PowerShellCorpus/Github/lazywinadmin_PowerShell/TOOL-Get-ScriptDirectory/Get-ScriptDirectory.ps1
Get-ScriptDirectory.ps1
function Get-ScriptDirectory { <# .SYNOPSIS This function retrieve the current folder path .DESCRIPTION This function retrieve the current folder path #> if($hostinvocation -ne $null) { Split-Path $hostinvocation.MyCommand.path } else { Split-Path $script:MyInvoca...
PowerShellCorpus/Github/lazywinadmin_PowerShell/TOOL-Get-LogFast/Get-LogFast.ps1
Get-LogFast.ps1
function Get-LogFast { <# .DESCRIPTION Function to read a log file very fast .SYNOPSIS Function to read a log file very fast .EXAMPLE Get-LogFast -Path C:\megalogfile.log .EXAMPLE Get-LogFast -Path C:\367.msp.0.log -Match "09:36:43:417" -Verbose VERBOSE: [PROCESS] Match foun...
PowerShellCorpus/Github/lazywinadmin_PowerShell/SCSM-Get-SCSMWorkItemChildItem/Get-SCSMWorkItemChildItemRA.ps1
Get-SCSMWorkItemChildItemRA.ps1
# Get the review activity $childWI_ReviewerActivityHasReviewers_Class_id = '6e05d202-38a4-812e-34b8-b11642001a80' $childWI_ReviewerActivityHasReviewers_Class_obj = Get-SCSMRelationshipClass -id $childWI_ReviewerActivityHasReviewers_Class_id # Get the reviewer $childWI_ReviewerisUser_Class_id = '90da7d7c-948b-e1...
PowerShellCorpus/Github/lazywinadmin_PowerShell/SCSM-Get-SCSMWorkItemChildItem/Get-SCSMWorkItemChildItem.ps1
Get-SCSMWorkItemChildItem.ps1
Function Get-SCSMWorkItemChildItem { param ( [Parameter(Mandatory = $True)] $inputPWI_guid ) ### Variables to Return $childWIs_obj = @() ### MAIN $inputPWI_obj = get-scsmobject -id $inputPWI_guid $containsActivity_relclass_id = '2da498be-0485-b2b2-d520-6ebd1698e61b' $childWIs_relobj_filter = "...
PowerShellCorpus/Github/lazywinadmin_PowerShell/TOOL-ConvertFrom-Base64/ConvertFrom-Base64.ps1
ConvertFrom-Base64.ps1
function ConvertFrom-Base64 { <# .SYNOPSIS Converts the specified string, which encodes binary data as base-64 digits, to an equivalent 8-bit unsigned integer array. .DESCRIPTION Converts the specified string, which encodes binary data as base-64 digits, to an equivalent 8-bit unsigned integer array. ...
PowerShellCorpus/Github/lazywinadmin_PowerShell/TOOL-Get-AsciiReaction/Get-AsciiReaction.ps1
Get-AsciiReaction.ps1
function Get-AsciiReaction { <# .SYNOPSIS Displays Ascii for different reactions and copies it to clipboard. .DESCRIPTION Displays Ascii for different reactions and copies it to clipboard. .EXAMPLE Get-AsciiReaction -Name Shrug Displays a shurg and copies it to clipboard. .NOTES ...
PowerShellCorpus/Github/lazywinadmin_PowerShell/AD-USER-Get-AccountLockedOut/AD-USER-Get-AccountLockedOut.ps1
AD-USER-Get-AccountLockedOut.ps1
Function Get-AccountLockedOut { <# .SYNOPSIS This function will find the device where the account get lockedout .DESCRIPTION This function will find the device where the account get lockedout. It will query directly the PDC for this information .PARAMETER DomainName Specifies the DomainName to query,...
PowerShellCorpus/Github/lazywinadmin_PowerShell/TOOL-Get-LocalGroup/Get-LocalGroup.ps1
Get-LocalGroup.ps1
function Get-LocalGroup { <# .SYNOPSIS This script can be list all of local group account. .DESCRIPTION This script can be list all of local group account. The function is using WMI to connect to the remote machine .PARAMETER ComputerName Specifies the computers on which the command . The d...
PowerShellCorpus/Github/lazywinadmin_PowerShell/O365-GROUP-Get-DistributionGroupRecursive/O365-GROUP-Get-DistributionGroupRecursive.ps1
O365-GROUP-Get-DistributionGroupRecursive.ps1
function Get-DistributionGroupMemberRecursive { <# .SYNOPSIS This script will list all the members (recursively) of a DistributionGroup .EXAMPLE Get-DistributionGroupMemberRecursive -Group TestDG -Verbose .NOTES Francois-Xavier Cat www.lazywinadmin.com @lazywinadm #> [CmdletBinding()...
PowerShellCorpus/Github/lazywinadmin_PowerShell/TOOL-New-DjoinFile/New-DjoinFile.ps1
New-DjoinFile.ps1
function New-DjoinFile { <# .SYNOPSIS Function to generate a blob file accepted by djoin.exe tool (offline domain join) .DESCRIPTION Function to generate a blob file accepted by djoin.exe tool (offline domain join) This function can create a file compatible with djoin with the...
PowerShellCorpus/Github/lazywinadmin_PowerShell/AD-SITE-Find_Missing_Subnets/AD-Find_missing_subnets_in_ActiveDirectory.ps1
AD-Find_missing_subnets_in_ActiveDirectory.ps1
<# .SYNOPSIS This script goal is to get all the missing subnets from the NETLOGON.LOG file from each Domain Controllers in the Active Directory. It will copy all the NETLOGON.LOG locally and parse them. .DESCRIPTION This script goal is to get all the missing subnets from the NETLOGON.LOG file fro...
PowerShellCorpus/Github/lazywinadmin_PowerShell/AD-SITE-Add-ADSubnet(ADSI)/Add-ADSubnet.ps1
Add-ADSubnet.ps1
Function Add-ADSubnet{ <# .SYNOPSIS This function allow you to add a subnet object in your active directory using ADSI .DESCRIPTION This function allow you to add a subnet object in your active directory using ADSI .PARAMETER Subnet Specifies the Name of the subnet to add .PARAMETER SiteName ...
PowerShellCorpus/Github/lazywinadmin_PowerShell/SCSM-Get-SCSMObjectPrefix/Get-SCSMObjectPrefix.ps1
Get-SCSMObjectPrefix.ps1
function Get-SCSMObjectPrefix { <# .SYNOPSIS Function to retrieve the Prefix used for the different WorkItem, Activities or Knowledge Article .DESCRIPTION Function to retrieve the Prefix used for the different WorkItem, Activities or Knowledge Article .PARAMETER ClassName Specified the ClassName ...
PowerShellCorpus/Github/lazywinadmin_PowerShell/TOOL-Get-LocalAdministrator/Get-LocalAdministrator.ps1
Get-LocalAdministrator.ps1
function Get-LocalAdministratorBuiltin { <# .SYNOPSIS function to retrieve the local Administrator account .DESCRIPTION function to retrieve the local Administrator account .PARAMETER ComputerName Specifies the computername .EXAMPLE PS C:\> Get-LocalAdministratorBuiltin .EXAMPLE P...
PowerShellCorpus/Github/lazywinadmin_PowerShell/TOOL-Get-StringCharCount/Get-StringCharCount.ps1
Get-StringCharCount.ps1
Function Get-StringCharCount { <# .SYNOPSIS This function will count the number of characters in a string .DESCRIPTION This function will count the number of characters in a string .EXAMPLE PS C:\> Get-StringCharCount -String "Hello World" 11 .NOTES Francois-Xavier Cat @lazywinadm www...
PowerShellCorpus/Github/lazywinadmin_PowerShell/TOOL-New-Password/New-Password.ps1
New-Password.ps1
function New-Password { <# .SYNOPSIS Function to Generate a new password. .DESCRIPTION Function to Generate a new password. By default it will generate a 12 characters length password, you can change this using the parameter Length. I excluded the following characters: ",',.,/,1,<,>,`,O,0,l,| ...
PowerShellCorpus/Github/lazywinadmin_PowerShell/TOOL-Expand-ScriptAlias/Expand-ScriptAlias.ps1
Expand-ScriptAlias.ps1
function Expand-ScriptAlias { <# .SYNOPSIS Function to replace Aliases used in a script by their fullname .DESCRIPTION Function to replace Aliases used in a script by their fullname. Using PowerShell AST we are able to retrieve the functions and cmdlets used in a script. .PARAMETER Path Specif...
PowerShellCorpus/Github/lazywinadmin_PowerShell/TOOL-Write-Log/TOOL-Write-Log.ps1
TOOL-Write-Log.ps1
function Write-Log { <# .SYNOPSIS Function to create or append a log file #> [CmdletBinding()] Param ( [Parameter()] $Path="", $LogName = "$(Get-Date -f 'yyyyMMdd').log", [Parameter(Mandatory=$true)] $Message = "", [Parameter()] ...
PowerShellCorpus/Github/lazywinadmin_PowerShell/TOOL-Remove-HashTableEmptyValue/Remove-HashTableEmptyValue.ps1
Remove-HashTableEmptyValue.ps1
Function Remove-HashTableEmptyValue { <# .SYNOPSIS This function will remove the empty or Null entry of a hashtable object .DESCRIPTION This function will remove the empty or Null entry of a hashtable object .PARAMETER Hashtable Specifies the hashtable that will be cleaned up. .EXAMPLE Remove-...
PowerShellCorpus/Github/lazywinadmin_PowerShell/SCCM-Get-SCCMClientCacheInformation/Get-SCCMClientCacheInformation.ps1
Get-SCCMClientCacheInformation.ps1
function Get-SCCMClientCacheInformation { <# .SYNOPSYS Function to get the cache size on a SCCM Client .DESCRIPTION Function to get the cache size on a SCCM Client .PARAMETER ComputerName Specifies the name of the client .PARAMETER Credential Specifies the credential to use against the re...
PowerShellCorpus/Github/lazywinadmin_PowerShell/TOOL-Test-RemoteDesktopIsEnabled/Test-RemoteDesktopIsEnabled.ps1
Test-RemoteDesktopIsEnabled.ps1
function Test-RemoteDesktopIsEnabled { <# .SYNOPSIS Function to check if RDP is enabled .DESCRIPTION Function to check if RDP is enabled .EXAMPLE Test-RemoteDesktopIsEnabled Test if Remote Desktop is enabled on the current machine .EXAMPLE Test-RemoteDesktopIsEnabled -ComputerName SERVER01,...
PowerShellCorpus/Github/lazywinadmin_PowerShell/TOOL-Set-RemoteDesktop/Set-RemoteDesktop.ps1
Set-RemoteDesktop.ps1
function Set-RemoteDesktop { <# .SYNOPSIS The function Set-RemoteDesktop allows you to enable or disable RDP remotely using the registry .DESCRIPTION The function Set-RemoteDesktop allows you to enable or disable RDP remotely using the registry .PARAMETER ComputerName Specifies the ComputerName ...
PowerShellCorpus/Github/lazywinadmin_PowerShell/SCCM-Get-SCCMDeviceCollectionDeployment/Get-SCCMDeviceCollectionDeployment.ps1
Get-SCCMDeviceCollectionDeployment.ps1
function Get-SCCMDeviceCollectionDeployment { <# .SYNOPSIS Function to retrieve a Device targeted application(s) .DESCRIPTION Function to retrieve a Device targeted application(s). The function will first retrieve all the collection where the Device is member of and find deployment advertised to th...
PowerShellCorpus/Github/lazywinadmin_PowerShell/TOOL-Get-NetFramework/Get-NetFramework.ps1
Get-NetFramework.ps1
function Get-NetFramework { <# .SYNOPSIS This function will retrieve the list of Framework Installed on the computer. .EXAMPLE Get-NetFramework PSChildName Version ----------- ------- ...
PowerShellCorpus/Github/lazywinadmin_PowerShell/TOOL-Get-ComputerOS/Get-ComputerOS.ps1
Get-ComputerOS.ps1
function Get-ComputerOS { <# .SYNOPSIS function to retrieve the Operating System of a machine .DESCRIPTION function to retrieve the Operating System of a machine .PARAMETER ComputerName Specifies the ComputerName of the machine to query. Default is localhost. .PARAMETER Credential Specifi...
PowerShellCorpus/Github/lazywinadmin_PowerShell/VMWARE-HOST-List_VIB/VMWARE-HOST-List_VIB.ps1
VMWARE-HOST-List_VIB.ps1
<# .DESCRIPTION This Script retrieve the VIB information on all the VMware Host .PARAMETER AllVib This is the default parameter to retrieve all the VIBs information .PARAMETER VIBName Specifies a specific VIB Name .PARAMETER VIBVendor Specifies a specific VIB Vendor .EXAMPLE VMWARE-HOST-List_VIB.ps1 -AllV...
PowerShellCorpus/Github/lazywinadmin_PowerShell/SCSM-IR-Get-SCSMIRComment/Get-SCSMIRComment.ps1
Get-SCSMIRComment.ps1
function Get-SCSMIRComment { <# .SYNOPSIS Function to retrieve all the comment of a Incident Request .DESCRIPTION Function to retrieve all the comment of a Incident Request .PARAMETER Incident Specifies the Incident Request Object. .EXAMPLE PS C:\> Get-SCSMIRComment -Incident (get-scsminc...
PowerShellCorpus/Github/lazywinadmin_PowerShell/TOOL-Read-ExcelFile/Read-ExcelFile-Example_Using_COM.ps1
Read-ExcelFile-Example_Using_COM.ps1
<# http://www.lazywinadmin.com/2014/03/powershell-read-excel-file-using-com.html #> [cmdletbinding()] PARAM ( [Parameter(Mandatory, HelpMessage = "You must specify the full path of the file")] [ValidateScript({ Test-Path -Path $_ })] $Path, [Parameter(Mandatory, HelpMessage = "You must specify th...
PowerShellCorpus/Github/lazywinadmin_PowerShell/TOOL-Remove-PSObjectProperty/Remove-PSObjectProperty.ps1
Remove-PSObjectProperty.ps1
function Remove-PSObjectProperty { <# .SYNOPSIS Function to Remove a specifid property from a PowerShell object .DESCRIPTION Function to Remove a specifid property from a PowerShell object .PARAMETER PSObject Specifies the PowerShell Object .PARAMETER Property Specifies the property to re...
PowerShellCorpus/Github/lazywinadmin_PowerShell/TOOL-Get-Uptime/Get-Uptime.ps1
Get-Uptime.ps1
function Get-Uptime { <# .SYNOPSIS The function Get-Uptime will get uptime of a local or remote machine. .DESCRIPTION The function Get-Uptime will get uptime of a local or remote machine. This function is compatible with CIM sessions and alternative credentials. .PARAMETER ComputerName Specifi...
PowerShellCorpus/Github/lazywinadmin_PowerShell/TOOL-New-RandomPassword/New-RandomPassword.ps1
New-RandomPassword.ps1
function New-RandomPassword { <# .SYNOPSIS Function to generate a complex and random password .DESCRIPTION Function to generate a complex and random password This is using the GeneratePassword method from the system.web.security.membership NET Class. https://msdn.microsoft.com/en-us/library/syste...
PowerShellCorpus/Github/lazywinadmin_PowerShell/SCCM-Add-SCCMGroupDeviceAffinity/Add-SCCMGroupDeviceAffinity.ps1
Add-SCCMGroupDeviceAffinity.ps1
Function Add-SCCMGroupDeviceAffinity { <# .SYNOPSIS Function to add a group as primary user on a device .DESCRIPTION Function to add a group as primary user on a device .PARAMETER SiteCode Specifies the SCCM SiteCode .PARAMETER SiteServer Specifies the SCCM Management Server .PARAMET...
PowerShellCorpus/Github/lazywinadmin_PowerShell/VMware-STORAGE-Get-VMhostHbaInfo/Get-VMhostHbaInfo.ps1
Get-VMhostHbaInfo.ps1
Function Get-VMhostHbaInfo { <# .SYNOPSIS The function Get-VMHostHBAInfo is gathering HBA cards information using PowerCli cmdlets and SSH connection to get additional details. .DESCRIPTION The function Get-VMHostHBAInfo is gathering HBA cards information using PowerCli cmdlets and SSH connection to get addit...
PowerShellCorpus/Github/lazywinadmin_PowerShell/TOOL-Out-Excel/Out-Excel.ps1
Out-Excel.ps1
function Out-Excel { <# .SYNOPSIS .DESCRIPTION .PARAMETER Property .PARAMETER Raw .NOTES Original Script: http://pathologicalscripter.wordpress.com/out-excel/ TODO: Parameter to change color of header Parameter to activate background color on Odd unit Add TRY/CATCH Validate Excel...
PowerShellCorpus/Github/lazywinadmin_PowerShell/TOOL-Set-NetworkLevelAuthentication/Set-NetworkLevelAuthentication.ps1
Set-NetworkLevelAuthentication.ps1
function Set-NetworkLevelAuthentication { <# .SYNOPSIS This function will set the NLA setting on a local machine or remote machine .DESCRIPTION This function will set the NLA setting on a local machine or remote machine .PARAMETER ComputerName Specify one or more computers .PARAMETER EnableNLA Spec...
PowerShellCorpus/Github/lazywinadmin_PowerShell/SCSM-Get-SCSMWorkItemAffectedUser/Get-SCSMWorkItemAffectedUser.ps1
Get-SCSMWorkItemAffectedUser.ps1
function Get-SCSMWorkItemAffectedUser { <# .SYNOPSIS Function to retrieve the Affected User of a Work Item .DESCRIPTION Function to retrieve the Affected User of a Work Item .PARAMETER SMObject Specifies the SMObject(s) on which the affected need to be retrieve. .PARAMETER Guid Specifies ...
PowerShellCorpus/Github/lazywinadmin_PowerShell/SCCM-New-SCCMDeviceVariable/New-SCCMDeviceVariable.ps1
New-SCCMDeviceVariable.ps1
function New-SCCMDeviceVariable { <# .SYNOPSIS function to create a new SCCM Device Variable .DESCRIPTION function to create a new SCCM Device Variable This function is relying on WMI to create a new SCCM Device Variable. You don't need the SCCM Module or SCCM Console installed to run it. Al...
PowerShellCorpus/Github/lazywinadmin_PowerShell/SCSM-Get-SCSMReviewActivityReviewer/Get-SCSMReviewActivityReviewer.ps1
Get-SCSMReviewActivityReviewer.ps1
function Get-SCSMReviewActivityReviewer { <# .SYNOPSIS Function to retrieve the reviewers of a Review Activity .DESCRIPTION Function to retrieve the reviewers of a Review Activity .PARAMETER ActivityObject Specifies the Service Manager Object .PARAMETER ActivityName Specifies the Name of the...
PowerShellCorpus/Github/lazywinadmin_PowerShell/TOOL-Get-ComputerInfo/Get-ComputerInfo.ps1
Get-ComputerInfo.ps1
#requires -Version 3 function Get-ComputerInfo { <# .SYNOPSIS This function query some basic Operating System and Hardware Information from a local or remote machine. .DESCRIPTION This function query some basic Operating System and Hardware Information from a local or remote machine. It r...
PowerShellCorpus/Github/lazywinadmin_PowerShell/AD-USER-Report_Expiring_users/AD-USER-Report_Expiring_users.ps1
AD-USER-Report_Expiring_users.ps1
<# .SYNOPSIS Script to report expiring user account .DESCRIPTION Script to report expiring user account .PARAMETER Days Specifies the number of days to look up .PARAMETER SearchBase Specifies the DistinguishedName .PARAMETER EmailFrom Specifies the email origin .PARAMETER EmailTo Specifies the email d...
PowerShellCorpus/Github/lazywinadmin_PowerShell/TOOL-Get-ImageInformation/Get-ImageInformation.ps1
Get-ImageInformation.ps1
function Get-ImageInformation { <# .SYNOPSIS function to retrieve Image file information .DESCRIPTION function to retrieve Image file information .PARAMETER FilePath Specify one or multiple image file path(s). .EXAMPLE PS C:\> Get-ImageInformation -FilePath c:\temp\image.png .NOTES Francois-Xav...