This file contains 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
#----------------------------------------------------------------------## | |
# Module Name : AuditServers.ps1 | |
# Created : 11.11.2016 | |
# Created by : Gisli Gudmundsson# LinkedIN : https://is.linkedin.com/in/gisli-gudmundsson-11a77639 | |
# License Usage : # This code can be used for private use only | |
# You may modify this code and distribute | |
##----------------------------------------------------------------------## | |
Import-Module ActiveDirectory | |
Import-Module C:\DynamicDocumentation\Dependencies\DEPMSSQLActions.psm1 -Force |
This file contains 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
#----------------------------------------------------------------------## | |
# Module Name : AuditServices.ps1 | |
# Created : 08.11.2016 | |
# Created by : Gisli Gudmundsson | |
# LinkedIN : https://is.linkedin.com/in/gisli-gudmundsson-11a77639 | |
# License Usage : | |
# This code can be used for private use only | |
# You may modify this code and distribute | |
##----------------------------------------------------------------------## | |
Import-Module ActiveDirectory |
This file contains 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
#----------------------------------------------------------------------## | |
# Module Name : DEPMSSQLActions.psm1 | |
# Created : 27.10.2016 | |
# Created by : Gisli Gudmundsson | |
# LinkedIN : https://is.linkedin.com/in/gisli-gudmundsson-11a77639# License Usage : | |
# This code can be used for private use only# You may modify this code and distribute | |
##----------------------------------------------------------------------# | |
#Import the SQL Server Powershell Module | |
Import-Module SqlServer |
This file contains 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
#----------------------------------------------------------------------# | |
# | |
# Module Name : DEPMSSQLActions.psm1 | |
# Created : 27.10.2016 | |
# Created by : Gisli Gudmundsson | |
# LinkedIN : https://is.linkedin.com/in/gisli-gudmundsson-11a77639 | |
# License Usage : | |
# This code can be used for private use only | |
# You may modify this code and distribute | |
# |
This file contains 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
#The C# Code starts with @ sign and ends with @ sign. | |
$CSharpCode = @" | |
public class ExampleCSharp | |
{ | |
public string ReturnTheString(string returnString) | |
{ | |
string Combine = "Your awesome text is : " + returnString; | |
return Combine; | |
} |
This file contains 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
#------------------ | |
# Lottery game by Gisli Gudmundsson | |
# Created 13.11.2016 | |
$ApplicationName = "PowerBalls" | |
$MaximumBallNumber = 20 | |
$TotalGamePlays = 1000000 | |
$RowWinningPercentage = 16.6667 | |
$WinningRow = 0 | |
$YourNumbers = "10","3","9","7","8","5" |
This file contains 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
#Import the values for the users | |
$UserValues = Import-Csv -Path c:\UserCreation\Users.csv -Delimiter ";"#Create the user function so I will not repeat myselffunctioncreateUsers($FirstName, $LastName, $Password, $Department){ | |
#The path for the user to be placed, in this scenario I put them in a department OU and Users | |
$OUPath = "OU=Users,OU=$Department,OU=Departments,DC=TSTDOMAIN,DC=COM" | |
#Convert the password to securestring | |
$AccountPassword = (ConvertTo-SecureString -AsPlainText $Password -Force) | |
#Create the Displayname, samaccountname, userprincipal name | |
$DisplayName = $FirstName+" "+$LastName |
This file contains 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
#CREATED BY GISLI GUDMUNDSSON | |
#GLOBAL VARIABLES | |
$MailTo = "admin@yourcompany.com" | |
$SmptServer = "yourmxserver.domain.com" | |
function SendInfectionMessage(){ | |
Send-MailMessage -To $MailTo -From "$env:COMPUTERNAME" -Subject "WannaCry Infection Detected - $env:COMPUTERNAME" -Body "WannaCry Infection Was Likely Detected on Computer $env:COMPUTERNAME. Please contact Username $env:USERNAME to investigate further. The Network Was Disabled On Remote Machine" -SmtpServer $SmtpServer |
This file contains 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
#Script created by Gísli Guðmundsson | |
#Created for Aron Gauti Birgisson | |
#Create Objects to set info about the computers who user logged on to | |
function setPingUser($ComputerName, $IPAddress, $User){ | |
New-Object psobject -Property @{ | |
ComputerName=$ComputerName; | |
IPAddress=$IPAddress; | |
User=$User; |
This file contains 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
$Cars = "Tyota","Hyundai","Ford" | |
#Where in Array | |
$Cars | Where-Object { $_ -eq "Hyundai" } | |
#Where in Array simpler | |
$Cars | Where { $_ -eq "Hyundai" } | |
#Where in Array much simpler | |
$Cars | ? { $_ -eq "Hyundai" } |