Last active
December 26, 2018 10:12
-
-
Save moziauddin/71ede135e9209e0b1b3d590680d23646 to your computer and use it in GitHub Desktop.
Windows Scripts
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
# Install Google Chrome from powershell - Windows 7, 10 and server 2012 | |
(new-object System.Net.WebClient).DownloadFile('http://dl.google.com/chrome/install/375.126/chrome_installer.exe', 'c:/temp/chrome.exe');. c:/temp/chrome.exe /silent /install;rm c:/temp -rec | |
#-------------------------------------------------------------------------------------------------------------- | |
# EXPORT MetaData.xml USING Windows Powershell ON A ADFS 3.0 SERVER ONTO THE ROOT OF C DRIVE | |
$metaUrl = (Get-ADFSEndpoint | where Protocol -eq "Federation Metadata").FullUrl.ToString() | |
$httpHelper = new-object System.Net.WebClient | |
$metadataAsString = $httpHelper.DownloadString($metaUrl) | |
$httpHelper.DownloadFile($metaUrl , "C:\metadata.xml") | |
#-------------------------------------------------------------------------------------------------------------- | |
# INSTALL COMMON APPLICATIONS ON WINDOWS 10 DESKTOP | |
$Strfpath1="C:\Program Files\Cylance\" | |
$Strfpath2="C:\Program Files (x86)\Cylance\" | |
IF ((Test-Path $Strfpath1) -Or (Test-Path $Strfpath2)) | |
{ | |
Write-Host "Cylance is already installed" | |
} | |
Else | |
{ | |
Start-Process "msiexec.exe" -Wait -NoNewWindow -ArgumentList "/i C:\ProgramData\SOEInstallers\General\CylanceProtect_x64.msi /qn PIDKEY= LAUNCHAPP=1" | |
} | |
$Strfpath1="C:\Program Files\7-Zip\" | |
$Strfpath2="C:\Program Files (x86)\7-Zip\" | |
IF ((Test-Path $Strfpath1) -Or (Test-Path $Strfpath2)) | |
{ | |
Write-Host "7-Zip is already installed" | |
} | |
Else | |
{ | |
Start-Process "msiexec.exe" -Wait -NoNewWindow -ArgumentList "/i C:\ProgramData\SOEInstallers\General\7z920-x64.msi /q" | |
} | |
$Strfpath1="C:\Program Files\Advanced Monitoring Agent Network Management\" | |
$Strfpath2="C:\Program Files (x86)\Advanced Monitoring Agent Network Management\" | |
IF ((Test-Path $Strfpath1) -Or (Test-Path $Strfpath2)) | |
{ | |
Write-Host "Max RM Agent is already installed" | |
} | |
Else | |
{ | |
Start-Process "C:\ProgramData\SOEInstallers\General\Max\SYM-FAU.EXE" -Wait | |
Write-Host "Max Agent has been Installed." -ForegroundColor DarkGreen | |
} | |
$Strfpath1="C:\Program Files\Dell\CommandUpdate\" | |
$Strfpath2="C:\Program Files (x86)\Dell\CommandUpdate\" | |
IF ((Test-Path $Strfpath1) -Or (Test-Path $Strfpath2)) | |
{ | |
Write-Host "Dell Command Update is already installed" | |
} | |
Else | |
{ | |
Start-Process "C:\ProgramData\CGL\SOEInstallers\General\DCU\DCU_Setup_2_3_1.exe" -ArgumentList "/s /v /qn" -Wait | |
Write-Host "Dell Command Update has been Installed." -ForegroundColor DarkGreen | |
} | |
$Strfpath1="C:\Program Files\Notepad++\" | |
$Strfpath2="C:\Program Files (x86)\Notepad++\" | |
IF ((Test-Path $Strfpath1) -Or (Test-Path $Strfpath2)) | |
{ | |
Write-Host "Notepad++ is already installed" | |
} | |
Else | |
{ | |
Start-Process "C:\ProgramData\CGL\SOEInstallers\General\npp.7.4.1.Installer.x64.exe" -ArgumentList "/S" -Wait | |
Write-Host "NPP has been Installed." -ForegroundColor DarkGreen | |
} | |
$Strfpath1="C:\Program Files\KeePass Password Safe 2\" | |
$Strfpath2="C:\Program Files (x86)\KeePass Password Safe 2\" | |
IF ((Test-Path $Strfpath1) -Or (Test-Path $Strfpath2)) | |
{ | |
Write-Host "KeePass 2.0 is already installed" | |
} | |
Else | |
{ | |
Start-Process "C:\ProgramData\CGL\SOEInstallers\General\KeePass-2.34-Setup.exe" -ArgumentList "/VERYSILENT" -Wait | |
Write-Host "KeePass-2 has been Installed." -ForegroundColor DarkGreen | |
} | |
$Strfpath1="C:\Program Files\Microsoft Office\Office16\EXCEL.EXE" | |
$Strfpath2="C:\Program Files (x86)\Microsoft Office\Office16\EXCEL.EXE" | |
IF ((Test-Path $Strfpath1) -Or (Test-Path $Strfpath2)) | |
{ | |
Write-Host "MS Office 16 is already installed" | |
} | |
Else | |
{ | |
Start-Process "C:\ProgramData\CGL\SOEInstallers\General\Office2016x64\Setup.exe" -Wait | |
Write-Host "Office 2016 - 64 bit has been Installed." -ForegroundColor DarkGreen | |
} | |
#Start-Process "msiexec.exe" -Wait -NoNewWindow -ArgumentList "/i tightvnc-2.5.1-setup-64bit.msi /quiet /norestart ADDLOCAL='Server/Viewer' VIEWER_ASSOCIATE_VNC_EXTENSION=1 SERVER_REGISTER_AS_SERVICE=1 SERVER_ADD_FIREWALL_EXCEPTION=1 VIEWER_ADD_FIREWALL_EXCEPTION=1 SERVER_ALLOW_SAS=1 SET_USEVNCAUTHENTICATION=1 VALUE_OF_USEVNCAUTHENTICATION=1 SET_PASSWORD=1 VALUE_OF_PASSWORD=bradfitl SET_USECONTROLAUTHENTICATION=1 VALUE_OF_USECONTROLAUTHENTICATION=1 SET_CONTROLPASSWORD=1 VALUE_OF_CONTROLPASSWORD=bradfitl SET_VIEWONLYPASSWORD=1 VALUE_OF_VIEWONLYPASSWORD=bradfitl SET_ACCERTRFBCONNECTIONS=1 VALUE_OF_ACCERTRFBCONNECTIONS=1" | |
#Start-Process "msiexec.exe" -Wait -NoNewWindow -ArgumentList "/i C:\ProgramData\SOEInstallers\General\SkypeSetup_7.25.0.106.msi /NORESTART" | |
#$pathvargs = {C:\ProgramData\CGL\SOEInstallers\General\npp.7.4.1.Installer.x64.exe /S} | |
#Invoke-Command -ScriptBlock $pathvargs | |
#$pathvargs = {C:\ProgramData\CGL\SOEInstallers\General\KeePass-2.34-Setup.exe /VERYSILENT} | |
#Invoke-Command -ScriptBlock $pathvargs | |
#$pathvargs = {C:\ProgramData\CGL\SOEInstallers\General\Max\SYM-FAU.EXE} | |
#Invoke-Command -ScriptBlock $pathvargs | |
#$pathvargs = {C:\ProgramData\CGL\SOEInstallers\General\Office2016x64\Setup.exe} | |
#Invoke-Command -ScriptBlock $pathvargs | |
#-------------------------------------------------------------------------------------------------------------- | |
# INSTALLER COPY USING POWERSHELL SCRIPT USING ANSIBLE | |
param ( | |
[Parameter(Mandatory=$True)] | |
[String]$DomainLogin, | |
[Parameter(Mandatory=$True)] | |
[String]$DomainPass | |
) | |
net use z: "\\wds-s1\Ins$\New" /user:"$DomainLogin" "$DomainPass" | |
Remove-Item "C:\ProgramData\SOEInstallers" -Recurse -Force | |
Copy-Item -Path Z: -Destination "C:\ProgramData\SOEInstallers" -Recurse -Force | |
#-------------------------------------------------------------------------------------------------------------- | |
# RENAME COMPUTER USING POWERSHELL SCRIPT USING ANSIBLE | |
param | |
( | |
[string]$newname = $(Throw "Missing the newname parameter") | |
) | |
$hostname = hostname | |
if($hostname -eq $newname) { | |
Write-Host "NOCHANGE" -NoNewline | |
exit | |
} else { | |
Rename-Computer -NewName "$newname" -Force -Restart | |
#-------------------------------------------------------------------------------------------------------------- | |
# DOMAIN JOIN A WINDOWS 10 PC USING POWERSHELL SCRIPT USING ANSIBLE | |
param | |
( | |
[parameter(Mandatory=$true)][string]$DomainName, | |
[parameter(Mandatory=$true)][string]$DomainNetbiosName | |
) | |
$CurrentDomain = (Get-WmiObject Win32_ComputerSystem).Domain | |
if($CurrentDomain -eq $DomainName) { | |
Write-Host "NOCHANGE" -NoNewline | |
} else { | |
$AdminUser = "Administrator@" + "$DomainName" | |
$creds = New-Object -TypeName System.Management.Automation.PSCredential -argumentlist ($AdminUser, (ConvertTo-SecureString "$DomainAdminPassword" -AsPlainText -Force)) | |
Add-Computer -DomainName "$DomainName" -Server "$DomainNetbiosName" -Credential $creds -Force | |
} | |
#-------------------------------------------------------------------------------------------------------------- | |
# Uninstall Sysmon on remote machines and print the before after status. | |
$tmrserver = Get-Content -Path C:\Users\svchpecm\Desktop\windowsServers.txt | |
echo $tmrserver | |
Invoke-Command -ComputerName $tmrserver -ScriptBlock {Get-Service -Name sysmon} | |
Invoke-Command -ComputerName $tmrserver -ScriptBlock {C:\sysmon\sysmon.exe -u} | |
Invoke-Command -ComputerName $tmrserver -ScriptBlock {Get-Service -Name sysmon} | |
#-------------------------------------------------------------------------------------------------------------- | |
#-------------------------------------------------------------------------------------------------------------- | |
#-------------------------------------------------------------------------------------------------------------- |
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
findstr /spin /C:"{}" * | |
goto done | |
Output: | |
21-dictionaries.py:2:dict1 = {} | |
21-dictionaries.py:23:Empty Dictionary {} | |
:done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment