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
Import-Csv "path\to\csv" | ForEach-Object { | |
try{ | |
Set-ADUser -Identity $_.samaccountname -add @{Proxyaddresses=$_.Proxyaddresses -split ";"} -ErrorAction Stop | |
Write-Host $_.samaccountname complete! -ForegroundColor Green | |
}catch{ | |
Write-Host 'Failed : ' -NoNewline | |
Write-Host $_.samaccountname -ForegroundColor Red | |
} | |
} |
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
#!/bin/bash | |
echo " | |
regular bold underline | |
$(tput setaf 1)Text $(tput bold)Text $(tput sgr0)$(tput setaf 1)$(tput smul)Text$(tput rmul) | |
$(tput setaf 2)Text $(tput bold)Text $(tput sgr0)$(tput setaf 2)$(tput smul)Text$(tput rmul) | |
$(tput setaf 3)Text $(tput bold)Text $(tput sgr0)$(tput setaf 3)$(tput smul)Text$(tput rmul) | |
$(tput setaf 4)Text $(tput bold)Text $(tput sgr0)$(tput setaf 4)$(tput smul)Text$(tput rmul) | |
$(tput setaf 5)Text $(tput bold)Text $(tput sgr0)$(tput setaf 5)$(tput smul)Text$(tput rmul) | |
$(tput setaf 6)Text $(tput bold)Text $(tput sgr0)$(tput setaf 6)$(tput smul)Text$(tput rmul) |
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
//Used to define what is returned in the async results | |
public static CimAsyncMultipleResults<CimInstance> GetValues(CimSession _session) { | |
return _session.QueryInstancesAsync(@"root\cimv2", "WQL", "SELECT Username FROM Win32_ComputerSystem"); | |
} | |
//This watches the async progress | |
class CimInstanceWatcher : IObserver<CimInstance> { | |
public void OnCompleted() { | |
Console.WriteLine("Done"); | |
} |
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
<Image Name="loadingImage" Margin="200" RenderTransformOrigin="0.5,0.5" Source="/SlickRHI;component/Assets/Images/Loading.png"> | |
<Image.Triggers> | |
<EventTrigger RoutedEvent="FrameworkElement.Loaded"> | |
<EventTrigger.Actions> <BeginStoryboard Storyboard="{StaticResource imageRotationStoryboard}" /> | |
</EventTrigger.Actions> | |
</EventTrigger> | |
</Image.Triggers> | |
<Image.RenderTransform> | |
<RotateTransform Angle="0"/> | |
</Image.RenderTransform> |
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
//Create a new MediaPlayer object | |
private static readonly MediaPlayer _backgroundMusic = new MediaPlayer(); | |
public static void StartBackgroundMusic(){ | |
//Open the temp WAV file saved in the temp location and called "backgroundmusic.wav" | |
_backgroundMusic.Open(new Uri(Path.Combine(Path.GetTempPath(), "backgroundmusic.wav"))); | |
//Add an event handler for when the media has ended, this way | |
//the music can be played on a loop | |
_backgroundMusic.MediaEnded += new EventHandler(BackgroundMusic_Ended); | |
//Start the music playing | |
_backgroundMusic.Play(); |
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
public static void SaveMusicToDisk(){ | |
//This sets up a new temporary file in the %temp% location called "backgroundmusic.wav" | |
using (FileStream fileStream = File.Create(Path.GetTempPath() + "backgroundmusic.wav")){ | |
//This them looks into the assembly and finds the embedded resource | |
//inside the WPF project, under the assets folder | |
//under the sounds folder called backgroundmusic.wav | |
//PLEASE NOTE: this will be different to you | |
Assembly.GetExecutingAssembly().GetManifestResourceStream("WPF.Assets.Sounds.backgroundmusic.wav").CopyTo(fileStream); | |
} |
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
#A class for holding info on music artists | |
class MusicArtist{ | |
[String]$Name | |
[Int]$Age | |
[Album[]]$Albums | |
} | |
#A class for holding info on music albums | |
class Album{ | |
[String]$Name |
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
class Album{ | |
[String]$Name | |
[DateTime]$DateReleased | |
} |
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
class MusicArtist{ | |
[String]$Name | |
[Int]$Age | |
[Album[]]$Albums | |
} |
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
#Creating a list to hold the people using the Person class | |
$People = New-Object 'System.Collections.Generic.List[PSObject]' | |
#Creating a new Person | |
$newPerson = [PersonClass]::new() | |
$newPerson.Name = "Roy Orbison" | |
$newPerson.Age = "24" | |
#Adding the new Person to the People list $People.Add($newPerson) | |
$People.Add($newPerson) |
NewerOlder