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
$username = "typeusernamehere" | |
[datetime]::FromFileTime((Get-ADDomainController -Filter * | foreach {Get-ADUser $username -Properties LastLogon -Server $_.Name | select LastLogon} | Measure-Object -Property LastLogon -Maximum).Maximum) |
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
$domainSearchList = Read-Host "Please enter a list of domain suffixes separated by semicolons (e.g. domain.local;domain.tld;int.domain.tld)" | |
$scopeToConfigure = Read-Host "Please enter the scope id of the scope to be configured (e.g. 192.168.1.0)" | |
$splittedDomainSearchList = $domainSearchList -split "\;" | |
$domainSearchListHexArray = @(); | |
Foreach ($domain in $splittedDomainSearchList) | |
{ | |
$splittedDomainParts = $domain -split "\." | |
Foreach ($domainPart in $splittedDomainParts) |
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
Function SavePictureToAD(szADsPath, szLoadFileName) | |
Dim objUser, bytesRead, adoStreamRead | |
Const adTypeBinary = 1 | |
Set adoStreamRead = CreateObject("ADODB.Stream") | |
adoStreamRead.Type = adTypeBinary | |
adoStreamRead.Open | |
adoStreamRead.LoadFromFile szLoadFileName | |
bytesRead = adoStreamRead.Read() | |
adoStreamRead.Close |
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
Function SavePictureToAdFromUrl(szADsPath, szUrl) | |
Dim objUser, bytesRead, adoStreamRead | |
Const adTypeBinary = 1 | |
Set xml = CreateObject("Microsoft.XMLHTTP") | |
xml.Open "GET", szUrl, False | |
xml.Send | |
If xml.status = 200 Then | |
Set adoStreamRead = CreateObject("ADODB.Stream") |
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
Imports System.Runtime.InteropServices | |
Module useraccountpicture | |
<DllImport("shell32.dll", EntryPoint:="#262", CharSet:=CharSet.Unicode, PreserveSig:=False)> _ | |
Private Sub SetUserTile(ByVal username As String, ByVal notneeded As Integer, ByVal picturefilename As String) | |
End Sub | |
Sub Main(ByVal args As String()) | |
If (args.Length = 2) Then |
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
using System; | |
using System.Runtime.InteropServices; | |
namespace useraccountpicture | |
{ | |
class Program | |
{ | |
[DllImport("shell32.dll", EntryPoint = "#262", CharSet = CharSet.Unicode, PreserveSig = false)] | |
public static extern void SetUserTile(string username, int notneeded, string picturefilename); |
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
Function LoadPictureFromAD(szADsPath, szSaveFileName) | |
Dim objUser, bytesRead, adoStreamWrite | |
Const adTypeBinary = 1, adSaveCreateOverWrite = 2 | |
Set objUser = GetObject(szADsPath) | |
bytesRead = objUser.Get("thumbnailPhoto") | |
Set adoStreamWrite = CreateObject("ADODB.Stream") | |
adoStreamWrite.Type = adTypeBinary | |
adoStreamWrite.Open |
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
create login your_sql_loginname with password = 'your_sql_loginspassword', sid = {your_sql_user_sid} |
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
use master | |
go | |
select sid, name, dbname from syslogins |
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
Set-ExecutionPolicy RemoteSigned | |
$UserCredential = Get-Credential | |
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell/ -Credential $UserCredential -Authentication Basic -AllowRedirection | |
Import-PSSession $Session | |
$DistributionGroup = "somerandomdistributiongroup@normanbauer.com" |
NewerOlder