Jump to content


Search the Community

Showing results for tags 'powershell'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Cloud
    • Azure
    • Microsoft Intune
    • Office 365
    • Windows 365
  • General Stuff
    • General Chat
    • Events
    • Site News
    • Official Forum Supporters
    • Windows News
    • Suggestion box
    • Jobs
  • MDT, SMS, SCCM, Current Branch &Technical Preview
    • How do I ?
    • Microsoft Deployment Toolkit (MDT)
    • SMS 2003
    • Configuration Manager 2007
    • Configuration Manager 2012
    • System Center Configuration Manager (Current Branch)
    • Packaging
    • scripting
    • Endpoint Protection
  • Windows Client
    • how do I ?
    • Windows 10
    • Windows 8
    • Windows 7
    • Windows Vista
    • Windows XP
    • windows screenshots
  • Windows Server
    • Windows Server General
    • Active Directory
    • Microsoft SQL Server
    • System Center Operations Manager
    • KMS
    • Windows Deployment Services
    • NAP
    • Failover Clustering
    • PKI
    • Hyper V
    • Exchange
    • IIS/apache/web server
    • System Center Data Protection Manager
    • System Center Service Manager
    • System Center App Controller
    • System Center Virtual Machine Manager
    • System Center Orchestrator
    • Lync
    • Application Virtualization
    • Sharepoint
    • WSUS

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Website URL


Location


Interests

  1. ====================================================================================================================================================================================== >> Available via download here on the TechNet Galleries! << ====================================================================================================================================================================================== I do have to admit that this tool is already available in it's final form for over a month, but it seemed appropriate to also post here about this final relase. I think this right-click action might be very usefull for most administrators. It also took quite a while before I finally made a 1.0 version of this script/ form. Now it’s there, I also have to admit that I’m even a bit proud of it! It was a nice way of getting familiar with PowerShell and WMI. With answering a few very basic questions, I'll try to provide as much information as possible. What functionalities does it provide?This right-click action shows a lot of detailed information about the collections of which a device is a member and also about the collections that the primary user of a device is a member. A quick overview of all the functionalities comes down to the following information per tab: Tab – General; The Name, Id. Limiting Collection, Last Update and Last Membership Change of the Collections. Tab – Deployments; The Name of the Collections and the Name, Type aand State of the targeted Deployments. Tab – Variables; The Name of the Collections and the Name, Value and Type of the Collection Variable. Tab – Maintenance Windows; The Name of the Collections and the Name, Start Time, Duration, Recurrence, Schedule, Type of the Maintenance Window. Tab – Power Management; The Name of the Collections, the Name of the Non-Peak Power Plan and the Name, Start Time, End Time and Wake-up Time of the devices in the Collection. Tab – Primary User: Tab – General; The Name of the Collections, Id, Limiting Collection, Last Update and the Last Membership Change of the Collections. Tab – Primary User: Tab – Deployments; The Name of the Collections and the Name, Type and State of the targeted Deployments. What does it look like?To show the power and usage of this right-click action, I created the following small movie: Where is it available?The final version of my Collection Details Form is publicly available via the TechNet Galleries and for a direct download, via ShowCollectionDetails_v1_0p.ps1. How can it be used?To use this script as a right-click action, save the script at [sCRIPTLOCATION], make sure that the folder <AdminConsoleInstallDir>\XmlStorage\Extensions\Actions\ed9dee86-eadd-4ac8-82a1-7234a4646e62 and the folder <AdminConsoleInstallDir>\XmlStorage\Extensions\Actions\3fd01cd1-9e01461e-92cd-94866b8d1f39 exist and add a XML file to those folders as specified here: <ActionDescription Class="Group" DisplayName="Custom Actions" MnemonicDisplayName="Custom Actions" Description="Custom Actions" SqmDataPoint="53"> <ShowOn> <string>ContextMenu</string> </ShowOn> <ActionGroups> <ActionDescription Class="Executable" DisplayName="Show Collection Details" MnemonicDisplayName="Show Collection Details" Description="Show Collection Details"> <ShowOn> <string>ContextMenu</string> </ShowOn> <Executable> <FilePath>PowerShell.exe</FilePath> <Parameters>-ExecutionPolicy ByPass -WindowStyle Hidden "[sCRIPTLOCATION]\ShowCollectionDetails_v1_0p.ps1" -ResourceId "##SUB:ResourceId##" -SiteCode "##SUB:SiteCode##" -SiteServer "##SUB:__Server##</Parameters> </Executable> </ActionDescription> </ActionGroups> </ActionDescription> Questions?Please don't hesitate to drop any questions, either here or via my own blog at: www.petervanderwoude.nl
  2. The script below will tell me the uptime on PC's. I want to add the language that says if Uptime is greater than X amount of days then it will send a reboot in 15 Mins. Any help would be appreciated. # This PS script provides Uptime and Pingstatus for list of computers. ####################################################################### $names = Get-Content "C:\Test\computers.txt" @( foreach ($name in $names) { if ( Test-Connection -ComputerName $name -Count 1 -ErrorAction SilentlyContinue ) { $wmi = gwmi Win32_OperatingSystem -computer $name $LBTime = $wmi.ConvertToDateTime($wmi.Lastbootuptime) [TimeSpan]$uptime = New-TimeSpan $LBTime $(get-date) Write-output "$name Uptime is $($uptime.days) Days" Write-Host "$name Uptime is $($uptime.days) Days" -ForegroundColor Green } else { Write-output "$name is not pinging" Write-Host "$name is not pinging" -ForegroundColor Red } } ) | Out-file -FilePath "C:\Test\results1.csv"
  3. Guys, We have several automatic deployment rules that create deployments based on computer type (Server / Workstation). The deployment groups are created automatically but the actual deployment must be created manually because the 'outage' window for windows updates differents every month (the date is set about 3 months prior). This means creating about 25 deployments manually, we have a template that we use per deployment but its very (very very (understatement) very) slow and time comsuming. SCCM is at 2012 R2, and all workstations are Windows 7. Servers are 2008, 2008 R2 and 2012 R2. Maintenance windows are not usable for us because it takes more than one month to deploy all the updates troughout all the (dtap) servers. With the new R2 there are some new powershell scripts available but as far as i can see no powershell is available for creating deployments on a automatically created deployement group. I've tried these without any luck : New-CMSoftwareUpdateAutoDeploymentRule New-CMSoftwareUpdateGroup Start-CMContentDistribution Start-CMSoftwareUpdateDeployment (the last one should work but i can't seem to get it working? http://social.technet.microsoft.com/Forums/en-US/7bf537bf-2b15-4676-b33b-6deb88882bcd/sccm-2012-sp1-creating-a-software-package-deployment-with-powershell?forum=configmanagersdk ) Does someone know if it's possible to create a software update deployment for an automatically created software update group?
  4. You can manually turn on Agent Proxy for all agents using PowerShell: get-SCOMagent | where {$_.ProxyingEnabled -match "False"} | Enable-SCOMAgentProxy How about making it the default setting? Any new agent deployed would automatically have proxy enabled? add-pssnapin "Microsoft.EnterpriseManagement.OperationsManager.Client"; new-managementGroupConnection -ConnectionString:scomserver.domain.com; set-location "OperationsManagerMonitoring::"; Set-DefaultSetting -Name HealthService\ProxyingEnabled -Value True Thank you Kevin Holman for posting this. View article... Connect with Mobieus Solutions: Sign Up Now: Infinity Connected™ Full Feature 30 Day Trial Read our Blog: http://blog.mobieus.com Follow on Twitter: http://www.twitter.com/MobieusLLC Visit the Support Center: Infinity Connected™ Support Center Let's Talk Shop: 1-800-691-6774 / support@mobieus.com
  5. Need help with how to set " Schedule a full update on this collection" for Device collections. I have a PowerShell script that creates over 90 Device collections for our environment in the Test lab right now. I can set all the setting I need even "Incremental updates" but I cannot figure out how to set a full schedule in the PowerShell Script. looking for any help. Thank You.
  6. I'm trying to run a script which will create a group within Active Directory, specific to the server being deployed in an OSD TS, and then add that group to the local admins on the server. The TS completes successfully but the group isn't created, no error is recorded in smsts log file. I can run the script manually on the server after the build completes, so the actual powershell code works, but it fails to do what it's meant to do during OSD. Anyone had any experience of anything similar to this (script is listed below)? #Add Active Directory server admin groups to local administrators #The script connects to AD, checks for the existence of the groups, creates them if necessarry, then adds them to the local admin #If the server is in the Test or Dev domains, the additional Domain Local group to allow for permissions to be granted to prod #domain accounts #check if the Active Directory powershell module has been imported, import if required. if (@(get-module | where-object{$_.name -eq "ActiveDirectory"}).count -eq 0) { import-module activedirectory } #set variables to be used in the script $comp = gc env:computername [string]$domainname = (get-addomain -identity (gwmi Win32_ComputerSystem).Domain).NetBIOSName [string]$domaindn=([adsi]("LDAP://ROOTDSE")).defaultnamingcontext $domaindn=$domaindn.tostring().toupper() $path=",OU=Local Server Administration,OU=groups,"+$domaindn $ggroup = "<groupname>-"+$comp $ggroupdn="CN="+$ggroup+$path $dlgroup = "<groupname>-"+$comp+"-L" $dlgroupdn="CN="+$dlgroup+$path switch -wildcard ($domaindn) { "*DEV" {[string]$pdc=(get-addomain <devdomain>).PDCEmulator} "*TEST" {[string]$pdc=(get-addomain <testdomain>).PDCEmulator} "*PROD" {[string]$pdc=(get-addomain <proddomain>).PDCEmulator} } #check for the existence of the AD security group, create it if needed $checkgroup=get-adgroup -server $pdc -filter{name -eq $ggroup} if ($checkgroup -eq $null) { $Description = "Local administration rights to " + $comp dsadd group $ggroupDN -samid $ggroup -desc $Description -s $pdc -u <user> -p <password> start-sleep -seconds 15 } # Add AD group to local administrators on the server #check if this is the prod domain, if not then create the domain local groups #if prod then add <server admins> group to local administrators if($domaindn -ne "<prod domain DN>") { $checkgroup=get-adgroup -server $pdc -filter {(name -eq $dlgroup)} if ($checkgroup -eq $null) { $Description = "Local administration rights to " + $comp + " for Prod Domain" dsadd group $dlgroupDN -samid $dlgroup -scope l -desc $Description -s $pdc -u <user name> -p <Password> start-sleep -seconds 15 } } else { }
  7. ============================================================================================================================== To reach an even wider audience. This is a new tool, which I released this monday. >> Available via download here on the TechNet Galleries! << ============================================================================================================================== The script creates a form to show the Collection Details for a specific device. Normally, from within the console, it is hard to see what collection settings are all affecting the device. By running this script it will directly show the collection memberships of the device including the applicable deployments, maintenance windows, power settings and collections variables.It uses the ResourceId as input, so it can easily be used as a right-click action (see my own blog for an example). To use this script the following input variables are required: ResourceId - Specify the ResourceId of the device. SiteCode - Specify the site code of the ConfigMgr site. SiteServer - Specifify the site server name. Example: PowerShell.exe -ExecutionPolicy ByPass .\ShowCollectionDetails_v0_9p.ps1 -ResourceId 16777224 -SiteCode PTP -SiteServer PTSRVR02 Version 0.9 shows the following details: (New!) Tab – General; The Name of the Collections. (New!) Tab – General; The Id of the Collections. (New!) Tab – General; The Limiting Collection of the Collections. (New!) Tab – General; The Last Update of the Collections. (New!) Tab – General; The Last Membership Change of the Collections. Tab – Deployments; The Name of the Collections. Tab – Deployments; The Name of the targeted Deployments. Tab – Deployments; The Type of the targeted Deployments. Tab – Deployments; The State of the targeted Deployments. Tab – Variables; The Name of the Collections. Tab – Variables; The Name of the Collection Variable. Tab – Variables; The Value of the Collection Variable. (Updated!) Tab – Variables; The Type of the Collection Variable. Tab – Maintenance Windows; The Name of the Collections. Tab – Maintenance Windows; The Name of the Maintenance Window. Tab – Maintenance Windows; The Start Time of the Maintenance Window. Tab – Maintenance Windows; The Duration of the Maintenance Window. Tab – Maintenance Windows; The Recurrence of the Maintenance Window. Tab – Maintenance Windows; The Schedule of the Maintenance Window. Tab – Maintenance Windows; The Type of the Maintenance Window. Tab – Maintenance Windows; Whether the Maintenance Window is enabled or not. Tab – Power Management; The Name of the Collections. Tab – Power Management; The Name of the Non-Peak Power Plan. Tab – Power Management; The Name of the Peak Power Plan. Tab – Power Management; The Start Time of the Peak Power Plan. Tab – Power Management; The End Time of the Peak Power Plan. Tab – Power Management; The Wake-up Time of the devices in the Collection. Please let me know what you like and don't like about this script/ tool at: www.petervanderwoude.nl
  8. Just wrote a basic script for importing PST files into mailboxes, that I want to share with the community. It is designed to check for PST files in the specified folder. Based on the filenames (of the PST files) it then verifies that a mailbox can be found. This is done by using the filename and adding the @ character and the domain value into a string value. If there is a match, it returns a value of $True and the script continues with running the New-MailboxImportRequest cmdlet. The script is written just as basic as it can, it provides much information about values and what’s going on. The most recent updated script can be downloaded here I hope this will help you to import the PST files into the mailboxes Ps. Sorry for the word-wrap, see the script file instead of copy the script code below Changelog v1.1 – Updated the $name variable due to issues with filenames got trimmed away. Also added so that if errors exists, they will be sent to a errorlog. Thanks to Chris Steding! # +======================================================================= # | Blog: http://www.testlabs.se/blog # | Twitter: @jonand82 # | ============================================= # | Filename: Import-PST v1.1.ps1 # | # | CREATED BY: Jonas Andersson # | FUNCTION: Imports PST files into mailboxes, matching on emailaddresses # | # | CHANGE LOG: # | v1.0 - 2013-09-18, *Created* # | v1.1 - 2013-09-22, *Update of $name variable* # | # | Required permissions (RBAC) Role: “Mailbox Import Export”, example: New-Managementroleassignment –Role “Mailbox Import Export” –User “Administrator” # +======================================================================= # Load snapin Add-PSSnapin Microsoft.Exchange.Management.PowerShell.E2010 -ErrorAction 'SilentlyContinue' # Variables $error.clear() $errorlog = "C:\temp\errorlog.txt" $pstpath = "C:\temp" $domain = "testlabs.se" $servername = "tlex01" $files = Get-ChildItem -Path $pstpath -Filter *.pst Write-Host $files if (($files -ne $null) -or ($files -eq "")) { foreach ($i in $files) { $name = $i.BaseName $id = $name + "@" + $domain $filename = $i.FullName $filename = $filename.Replace(":","$") $uncfilepath = "\\" + $servername + "\" + $filename Write-Host "#################################################################" Write-Host "Filename:" $i -ForegroundColor 'Cyan' Write-Host "UNC path:" $uncfilepath -ForegroundColor 'DarkCyan' Write-Host "Emailaddress:" $id -ForegroundColor 'DarkGreen' $MailboxExists = [bool](Get-Mailbox -Identity $id -ErrorAction SilentlyContinue) if ($MailboxExists -eq $false) { Write-Host "Found mailbox:" $MailboxExists -ForegroundColor 'Red' Write-Host "Make sure to match filename to mailaddress, without @domain" -ForegroundColor 'Red' } if ($MailboxExists -eq $true) { Write-Host "Found mailbox:" $MailboxExists -ForegroundColor 'Green' Write-Host "Importing $uncfilepath into mailbox: $id" -ForegroundColor 'White' New-MailboxImportRequest -Mailbox $id -FilePath $uncfilepath } Write-Host "" } } else { Write-Host "No PST files found" } if ($error -ne $null) { $error | Out-File -FilePath $errorlog -Append Write-Host "See $errorlog for errors" -ForegroundColor 'Red' }
  9. I’ve updated a script that was intended for installing prerequisites for Exchange 2010 that were released by a couple of peoples (Anderson Patricio, Pat Richard and Bhargav Shukla). This script have now been updated and applies to Exchange 2013. It will help you with installing all prerequisites (features) plus the FilterPack(s) and the Unified Communications Managed API. It also provides the option to disable the UAC (User Access Control) and the Windows Firewall. You can download the script here Feel free to use it as much as you want, I just want to mention I do not provide support for it and there are no warranty. The script/code can be viewed below: ############################################################################# # Install-Exchange2013PreReqs.ps1 # Configures the necessary prerequisites to install Exchange 2013 on a # Windows Server 2008 R2 server or Windows Server 2012 server # # Updated by: Jonas Andersson # Original written by: Pat Richard, Anderson Patricio and Bhargav Shukla # # Some info taken from # http://www.ucblogs.net/blogs/exchange/archive/2009/12/12/Automated-prerequisite-installation-via-PowerShell-for-Exchange-Server-2010-on-Windows-Server-2008-R2.aspx">http://www.ucblogs.net/blogs/exchange/archive/2009/12/12/Automated-prerequisite-installation-via-PowerShell-for-Exchange-Server-2010-on-Windows-Server-2008-R2.aspx # http://msmvps.com/blogs/andersonpatricio/archive/2009/11/13/installing-exchange-server-2010-pre-requisites-on-windows-server-2008-r2.aspx">http://msmvps.com/blogs/andersonpatricio/archive/2009/11/13/installing-exchange-server-2010-pre-requisites-on-windows-server-2008-r2.aspx # http://www.bhargavs.com/index.php/powershell/2009/11/script-to-install-exchange-2010-pre-requisites-for-windows-server-2008-r2/">http://www.bhargavs.com/index.php/powershell/2009/11/script-to-install-exchange-2010-pre-requisites-for-windows-server-2008-r2/ ############################################################################# # Detect correct OS here and exit if no match if (-not((Get-WMIObject win32_OperatingSystem).OSArchitecture -eq '64-bit') -and (((Get-WMIObject win32_OperatingSystem).Version -eq "6.1.7601") -or (Get-WMIObject win32_OperatingSystem).Version -eq "6.2.9200")){ Write-Host "This script requires a 64bit version of Windows Server 2008 R2 or Windows Server 2012, which this is not." -ForegroundColor Red -BackgroundColor Black Exit } Function Disable-UAC(){ $path = "HKLM:\Software\Microsoft\Windows\CurrentVersion\Policies\System" $a = Get-ItemProperty $path -Name EnableLUA if ($a | Select-String "0") { Write-Host "UAC is already disabled" -ForegroundColor Green return } if ($a | Select-String "1") { Write-Host "Enabled" -ForegroundColor Red Set-ItemProperty "HKLM:\Software\Microsoft\Windows\CurrentVersion\Policies\System" -Name "EnableLUA" -Value 0 Write-host "Registry key HKLM:\Software\Microsoft\Windows\CurrentVersion\Policies\System\EnableLUA has been changed." -ForegroundColor yellow Write-Host "UAC is now disabled" -ForegroundColor Green } } Function Disable-FW(){ $status = netsh advfirewall show allprofiles state if ($status | Select-String "ON") { $enabled = $true } else { $enabled = $false } if ($enabled -eq $true) { netsh advfirewall set allprofiles state off Write-Host "Firewall is now disabled" -ForegroundColor yellow return } if ($enabled -eq $false) { Write-Host "Firewall is already disabled" -ForegroundColor Green } } Function InstallFilterPack(){ if (Get-ItemProperty "HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall\{95140000-2000-0409-1000-0000000FF1CE}" -ErrorAction SilentlyContinue) { Write-host "FilterPack is already installed." -ForegroundColor yellow return } else { trap { Write-Host "Problem downloading FilterPackx64.exe. Please visit: <a href="http://www.microsoft.com/en-us/download/details.aspx?id=26604">http://www.microsoft.com/en-us/download/details.aspx?id=26604</a> and <a href="http://www.microsoft.com/en-us/download/details.aspx?id=17062"'>http://www.microsoft.com/en-us/download/details.aspx?id=17062"">http://www.microsoft.com/en-us/download/details.aspx?id=17062"</a> break } #set a var for the folder you are looking for $folderPath = 'C:\Temp' #Check if folder exists, if not, create it if (Test-Path $folderpath){ Write-Host "The folder $folderPath exists." } else{ Write-Host "The folder $folderPath does not exist, creating..." -NoNewline New-Item $folderpath -type directory | Out-Null Write-Host "done!" -ForegroundColor Green } # Check if file exists, if not, download it $file1 = $folderPath+"\FilterPack64bit.exe" $file2 = $folderPath+"\filterpack2010sp1-kb2460041-x64-fullfile-en-us.exe" if (Test-Path $file1){ write-host "The file $file1 exists." } else { #Download Microsoft Filter Pack Write-Host "Downloading Microsoft Filter Pack..." -nonewline $clnt = New-Object System.Net.WebClient $url = "<a href="http://download.microsoft.com/download/0/A/2/0A28BBFA-CBFA-4C03-A739-30CCA5E21659/FilterPack64bit.exe"'>http://download.microsoft.com/download/0/A/2/0A28BBFA-CBFA-4C03-A739-30CCA5E21659/FilterPack64bit.exe"">http://download.microsoft.com/download/0/A/2/0A28BBFA-CBFA-4C03-A739-30CCA5E21659/FilterPack64bit.exe"</a> $clnt.DownloadFile($url,$file1) Write-Host "done!" -ForegroundColor Green } if (Test-Path $file2){ write-host "The file $file2 exists." } else { #Download Microsoft Filter Pack SP1 Write-Host "Downloading Microsoft Filter Pack SP1..." -nonewline $clnt = New-Object System.Net.WebClient $url = "<a href="http://download.microsoft.com/download/A/A/3/AA345161-18B8-45AE-8DC8-DA6387264CB9/filterpack2010sp1-kb2460041-x64-fullfile-en-us.exe"'>http://download.microsoft.com/download/A/A/3/AA345161-18B8-45AE-8DC8-DA6387264CB9/filterpack2010sp1-kb2460041-x64-fullfile-en-us.exe"">http://download.microsoft.com/download/A/A/3/AA345161-18B8-45AE-8DC8-DA6387264CB9/filterpack2010sp1-kb2460041-x64-fullfile-en-us.exe"</a> $clnt.DownloadFile($url,$file2) Write-Host "done!" -ForegroundColor Green } #Install Microsoft Filter Packs Write-Host "Installing Microsoft Filter Packs..." $args = "/quiet /norestart" $setup1 = (Start-Process $file1 -ArgumentList $args -Wait -PassThru).ExitCode if ($setup1 -eq 0) { write-host "Successfully installed $file1" -ForegroundColor Green } if ($setup1 -ne 0) { write-host "Failed!" -ForegroundColor Red } $setup2 = (Start-Process $file2 -ArgumentList $args -Wait -PassThru).ExitCode if ($setup2 -eq 0) { write-host "Successfully installed $file2" -ForegroundColor Green } if ($setup2 -ne 0) { write-host "Failed!" -ForegroundColor Red } } } Function InstallUMAPI(){ #Change reg key below! if (Get-ItemProperty "HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall\UCMA4" -ErrorAction SilentlyContinue) { Write-host "Unified Communications Managed API 4.0 Runtime is already installed." -ForegroundColor yellow return } else { trap { Write-Host "Problem downloading UM API. Please visit: <a href="http://www.microsoft.com/en-us/download/details.aspx?id=34992"'>http://www.microsoft.com/en-us/download/details.aspx?id=34992"">http://www.microsoft.com/en-us/download/details.aspx?id=34992"</a> break } #set a var for the folder you are looking for $folderPath = 'C:\Temp' #Check if folder exists, if not, create it if (Test-Path $folderpath){ Write-Host "The folder $folderPath exists." } else{ Write-Host "The folder $folderPath does not exist, creating..." -NoNewline New-Item $folderpath -type directory | Out-Null Write-Host "done!" -ForegroundColor Green } # Check if file exists, if not, download it $file = $folderPath+"\UcmaRuntimeSetup.exe" if (Test-Path $file){ write-host "The file $file exists." } else { #Download Microsoft UM API Write-Host "Downloading Microsoft UM API..." -nonewline $clnt = New-Object System.Net.WebClient $url = "<a href="http://download.microsoft.com/download/2/C/4/2C47A5C1-A1F3-4843-B9FE-84C0032C61EC/UcmaRuntimeSetup.exe"'>http://download.microsoft.com/download/2/C/4/2C47A5C1-A1F3-4843-B9FE-84C0032C61EC/UcmaRuntimeSetup.exe"">http://download.microsoft.com/download/2/C/4/2C47A5C1-A1F3-4843-B9FE-84C0032C61EC/UcmaRuntimeSetup.exe"</a> $clnt.DownloadFile($url,$file) Write-Host "done!" -ForegroundColor Green } #Check/Install Media Foundation feature $mf = Get-WindowsFeature "Server-Media-Foundation" | select * Start-Sleep 2 if ($mf.Installed -eq $False) { Write-Host "Installing Media Foundation feature..." -ForegroundColor Green Add-Windowsfeature Server-Media-Foundation Write-Host "" Write-Host "Installing of Media Foundation feature completed." -ForegroundColor Green Write-Host "" Write-Host "Restart the server and restart the task" -ForegroundColor Red Write-Host "or else the UM API won't be installed" -ForegroundColor Red Write-Host "" return } if ($mf.Installed -eq $True) { #Install Microsoft UM API Write-Host "Installing Microsoft UM API..." -ForegroundColor Green $args = "/quiet /norestart" $setup = (Start-Process $file -ArgumentList $args -Wait -PassThru).ExitCode if ($setup -eq 0) { write-host "Successfully installed $file" -ForegroundColor Green } if ($setup -ne 0) { write-host "Failed!" -ForegroundColor Red } } } } Import-Module ServerManager $opt = "None" # Do { clear if ($opt -ne "None") {write-host "Last command: "$opt -foregroundcolor Yellow} write-host write-host Exchange Server 2013 - Prerequisites script write-host Please, select which role you are going to install.. write-host write-host '1) Client Access Server' write-host '2) Mailbox' write-host '3) Typical (CAS/Mailbox)' write-host write-host '10) Install Microsoft Filter Pack 2.0' write-host ' Required if installing Mailbox Server roles' -foregroundcolor yellow write-host ' Automatically set for options 2 and 3' -foregroundcolor yellow write-host '11) Install Microsoft UM API' write-host ' Required if installing Mailbox Server roles' -foregroundcolor yellow Write-Host '12) Disable UAC' Write-Host '13) Disable Firewall' write-host write-host '15) Restart the Server' write-host '16) End' write-host $opt = Read-Host "Select an option.. [1-14]? " switch ($opt) { 1 { # Windows Server 2008 R2 SP1 if ((Get-WMIObject win32_OperatingSystem).Version -eq "6.1.7601") { Import-Module ServerManager Add-WindowsFeature "Desktop-Experience", "NET-Framework", "NET-HTTP-Activation", "RPC-over-HTTP-proxy", "RSAT-Clustering", "RSAT-Web-Server", "WAS-Process-Model", "Web-Asp-Net", "Web-Basic-Auth", "Web-Client-Auth", "Web-Digest-Auth", "Web-Dir-Browsing", "Web-Dyn-Compression", "Web-Http-Errors", "Web-Http-Logging", "Web-Http-Redirect", "Web-Http-Tracing", "Web-ISAPI-Ext", "Web-ISAPI-Filter", "Web-Lgcy-Mgmt-Console", "Web-Metabase", "Web-Mgmt-Console", "Web-Mgmt-Service", "Web-Net-Ext", "Web-Request-Monitor", "Web-Server", "Web-Stat-Compression", "Web-Static-Content", "Web-Windows-Auth", "Web-WMI" -restart } # Windows Server 2012 if ((Get-WMIObject win32_OperatingSystem).Version -eq "6.2.9200") { Install-WindowsFeature "AS-HTTP-Activation", "Desktop-Experience", "NET-Framework-45-Features", "RPC-over-HTTP-proxy", "RSAT-Clustering", "RSAT-Clustering-CmdInterface", "RSAT-Clustering-Mgmt", "RSAT-Clustering-PowerShell", "Web-Mgmt-Console", "WAS-Process-Model", "Web-Asp-Net45", "Web-Basic-Auth", "Web-Client-Auth", "Web-Digest-Auth", "Web-Dir-Browsing", "Web-Dyn-Compression", "Web-Http-Errors", "Web-Http-Logging", "Web-Http-Redirect", "Web-Http-Tracing", "Web-ISAPI-Ext", "Web-ISAPI-Filter", "Web-Lgcy-Mgmt-Console", "Web-Metabase", "Web-Mgmt-Console", "Web-Mgmt-Service", "Web-Net-Ext45", "Web-Request-Monitor", "Web-Server", "Web-Stat-Compression", "Web-Static-Content", "Web-Windows-Auth", "Web-WMI", "Windows-Identity-Foundation" -restart } } 2 { # Windows Server 2008 R2 SP1 if ((Get-WMIObject win32_OperatingSystem).Version -eq "6.1.7601") { Import-Module ServerManager InstallFilterPack Add-WindowsFeature "Desktop-Experience", "NET-Framework", "NET-HTTP-Activation", "RPC-over-HTTP-proxy", "RSAT-Clustering", "RSAT-Web-Server", "WAS-Process-Model", "Web-Asp-Net", "Web-Basic-Auth", "Web-Client-Auth", "Web-Digest-Auth", "Web-Dir-Browsing", "Web-Dyn-Compression", "Web-Http-Errors", "Web-Http-Logging", "Web-Http-Redirect", "Web-Http-Tracing", "Web-ISAPI-Ext", "Web-ISAPI-Filter", "Web-Lgcy-Mgmt-Console", "Web-Metabase", "Web-Mgmt-Console", "Web-Mgmt-Service", "Web-Net-Ext", "Web-Request-Monitor", "Web-Server", "Web-Stat-Compression", "Web-Static-Content", "Web-Windows-Auth", "Web-WMI" -restart } # Windows Server 2012 if ((Get-WMIObject win32_OperatingSystem).Version -eq "6.2.9200") { InstallFilterPack Install-WindowsFeature "AS-HTTP-Activation", "Desktop-Experience", "NET-Framework-45-Features", "RPC-over-HTTP-proxy", "RSAT-Clustering", "RSAT-Clustering-CmdInterface", "RSAT-Clustering-Mgmt", "RSAT-Clustering-PowerShell", "Web-Mgmt-Console", "WAS-Process-Model", "Web-Asp-Net45", "Web-Basic-Auth", "Web-Client-Auth", "Web-Digest-Auth", "Web-Dir-Browsing", "Web-Dyn-Compression", "Web-Http-Errors", "Web-Http-Logging", "Web-Http-Redirect", "Web-Http-Tracing", "Web-ISAPI-Ext", "Web-ISAPI-Filter", "Web-Lgcy-Mgmt-Console", "Web-Metabase", "Web-Mgmt-Console", "Web-Mgmt-Service", "Web-Net-Ext45", "Web-Request-Monitor", "Web-Server", "Web-Stat-Compression", "Web-Static-Content", "Web-Windows-Auth", "Web-WMI", "Windows-Identity-Foundation" -restart } } 3 { if ((Get-WMIObject win32_OperatingSystem).Version -eq "6.1.7601") { Import-Module ServerManager InstallFilterPack Add-WindowsFeature "Desktop-Experience", "NET-Framework", "NET-HTTP-Activation", "RPC-over-HTTP-proxy", "RSAT-Clustering", "RSAT-Web-Server", "WAS-Process-Model", "Web-Asp-Net", "Web-Basic-Auth", "Web-Client-Auth", "Web-Digest-Auth", "Web-Dir-Browsing", "Web-Dyn-Compression", "Web-Http-Errors", "Web-Http-Logging", "Web-Http-Redirect", "Web-Http-Tracing", "Web-ISAPI-Ext", "Web-ISAPI-Filter", "Web-Lgcy-Mgmt-Console", "Web-Metabase", "Web-Mgmt-Console", "Web-Mgmt-Service", "Web-Net-Ext", "Web-Request-Monitor", "Web-Server", "Web-Stat-Compression", "Web-Static-Content", "Web-Windows-Auth", "Web-WMI" -restart } # Windows Server 2012 if ((Get-WMIObject win32_OperatingSystem).Version -eq "6.2.9200") { InstallFilterPack Install-WindowsFeature "AS-HTTP-Activation", "Desktop-Experience", "NET-Framework-45-Features", "RPC-over-HTTP-proxy", "RSAT-Clustering", "RSAT-Clustering-CmdInterface", "RSAT-Clustering-Mgmt", "RSAT-Clustering-PowerShell", "Web-Mgmt-Console", "WAS-Process-Model", "Web-Asp-Net45", "Web-Basic-Auth", "Web-Client-Auth", "Web-Digest-Auth", "Web-Dir-Browsing", "Web-Dyn-Compression", "Web-Http-Errors", "Web-Http-Logging", "Web-Http-Redirect", "Web-Http-Tracing", "Web-ISAPI-Ext", "Web-ISAPI-Filter", "Web-Lgcy-Mgmt-Console", "Web-Metabase", "Web-Mgmt-Console", "Web-Mgmt-Service", "Web-Net-Ext45", "Web-Request-Monitor", "Web-Server", "Web-Stat-Compression", "Web-Static-Content", "Web-Windows-Auth", "Web-WMI", "Windows-Identity-Foundation" -restart } } 10 { # future - auto detect Internet access write-host 'Can this server access the Internet?' $filtpack = read-host 'Please type (Y)es or (N)o...' switch ($filtpack) { Y { InstallFilterPack } N {Write-warning 'Please download and install Microsoft Filter Pack from here: <a href="http://www.microsoft.com/en-us/download/details.aspx?id=26604">http://www.microsoft.com/en-us/download/details.aspx?id=26604</a> and <a href="http://www.microsoft.com/en-us/download/details.aspx?id=17062'}">http://www.microsoft.com/en-us/download/details.aspx?id=17062'}</a> } } 11 { # future - auto detect Internet access write-host 'Can this server access the Internet?' $umapi = read-host 'Please type (Y)es or (N)o...' switch ($umapi) { Y { InstallUMAPI } N {Write-warning 'Please download and install Microsoft UM API from here: <a href="http://www.microsoft.com/en-us/download/details.aspx?id=34992'}">http://www.microsoft.com/en-us/download/details.aspx?id=34992'}</a> } } 12 { Disable-UAC } 13 { Disable-FW } 15 { Restart-Computer } 16 { Write-Host "Exiting..." Exit } default {write-host "You haven't selected any of the available options. "} }
  10. Hi All, I am trying to find a solution that will update the built in Windows Modern applications (i.e. Bing, Mail, Calendar etc) automatically. I cannot find any powershell or other script that has the ability to update these apps without launching the apps store and then hitting update. Everything I search for has the ability to remove the applications but nothing to update them with. I can use powershell to discover the applications requiring updates but nothing to get them to update: Get-EventLog -LogName system -Newest 2 -InstanceId 17 -source *update*| select timewritten,message | ft -AutoSize –Wrap Because none of the Modern Applications tie into Windows Updates it is not something that can be done with WSUS. I have discovered the Group Policy options are available for the store (as per MS KB http://support.microsoft.com/kb/2826659) which allows updates from the store to be disabled easily but nothing to schedule or install the updates automatically. Any suggestions would be appreciated. Pete
  11. Hello All, We are performing LTI with the UDI module. When administrator enters the intended name of the computer we need to get this name (presumably OSDComputerName task sequence variable) and add some text to it. We already got the concatenating portion of the script, but need help with the first part and the third parts. So, basically we need to perform the following sub-tasks: Get the task sequence variable with the intended computer name which was entered by the administrator. Verify/modify it (this portion we already implemented) Set the task sequence variable using the modified computer name. Would you be so kind to advise on the following questions: Should we use the OSDComputerName task sequence variable or any other else? What the code in the PowerShell should be in order to get the input from the administrator and set the new computer name? What is the proper location of this task should be in the task sequence? We prefer to get it before the OS is installed, but would highly appreciate if you provide is with the location. Also, we received the following error: PS C:\Windows\system32> $tsenv = New-Object -COMObject Microsoft.SMS.TSEnvironment New-Object : Cannot load COM type Microsoft.SMS.TSEnvironment. At line:1 char:20 + $tsenv = New-Object <<<< -COMObject Microsoft.SMS.TSEnvironment + CategoryInfo : InvalidType: ( [New-Object], PSArgumentException + FullyQualifiedErrorId : CannotLoadComObjectType,Microsoft.PowerShell.Commands.NewObjectCommand Thank you very much for your time and help!
  12. Hi, I have to modify a distribution point value with powershell script. The value is PrestageAllowed who locate in wmi class SMS_SCI_SYSRESUSE like screenshot http://imageshack.us/photo/my-images/27/sanstitrewi.png/ Thanks fz
  13. Hey all, I'm looking to use Powershell to list all collections a particular Computer is a member of. I have a way of listing all the members of a particular collection, but I don't have the reverse, which would be listing all the collections a member is in. I'll post what I've got. PS C:\> (get-command Get-CollectionMember).ScriptBlock Param($CollName) $SiteCode="ATL" $SCCMServer="SCCM" # Get a list of collections and find the object to build the collection list. $Collection = Get-WmiObject -ComputerName $SCCMServer -Namespace ` "root\sms\site_$SiteCode" -Class 'SMS_Collection' $MyCollection = $Collection | Where-Object { $_.Name -eq $CollName } # Grab the Resource ID of the collection $MyCollectionMembers = Get-WmiObject -ComputerName $SCCMServer -Namespace ` "root\sms\site_$SiteCode" -Query "select * from SMS_CM_RES_COLL_$($MyCollection.CollectionID)" #Echo member of the collections to screen Foreach ($member in $MyCollectionMembers) { $oldErrCount = $error.Count $Name = $member.Name.ToString() $Name } I found this code somewhere online and modified it to fit. Now, this will list all of the members of a specified collection, but can't be used to find all the collections a member is in. Anyone have any ideas?
  14. Hey guys, Lately I've been setting up a back-end script for one of our customers. Part of this script was designed to send an email to the manager with the user and password for their newly created users. I posted the Email function on the tech-blog if anyone needs it. http://heineborn.com/tech/sending-email-via-powershell/ Take care.
  15. Hey guys, After setting up a new domain and deploying SCCM 2012 I came to realize how much work it actually is to set up new applications. I have made a script which creates AD groups and Collections. I still create the Applications manually because they usually differ when it comes to how they need to be set up. Some products can be imported as Applications (MSI etc) while some (Autodesk products in particular) need to be set up as Packages. Here's a link to the script. http://heineborn.com/tech/powershell-create-collections-and-ad-groups/ Enjoy!
  16. Hello, I'm searching for a way to install Windows Updates using powershell. When deploying updates with WSUS it is possible to use Microsoft.Update COM object and get a list of approved updates, iterate through the list and install updates one by one. Something similar was possible with SCCM Client 2007: http://learn-powersh...he-sccm-client/ unfortunately it looks like in SCCM Client 2012 the method EnumerateUpdates is missing (among many other methods from Class CCMUpdatesDeployment). Is there any other way to achieve the same controlled Windows updates installation with SCCM Client 2012 ? Tnx, Jan
  17. A time ago I was creating a powershell script for consolidating pst files and import them into the proper mailbox I'm going to upload the article here, but in the first place, here's the link to the post http://www.testlabs.se/blog/2012/01/25/consolidate-pst-files/ Happy to read your feedback about it Cheers
  18. Project Description InstallSiteServer.ps1 is a PowerShell script that installs Configuration Manager 2007 Secondary Site server automatically. Currently this script is written for only Windows Server 2008 R2 and Configuration Manager 2007. InstallSiteServer.ps1 uses XML file based configuration file to read how to prepare site server. The main goal for this project is to simplify as much as possible ConfigMgr Site System installation. You can configure in the configuration file: What server roles will be installed or not What additional software you want to install on that server e.g. WSUS, DOTNET 4.0 etc. Configuration Manager installation files location What hotfixes will be installed What IIS file types should be enabled or not Enable IIS hidden segment removal Send an email with logs to your email This script is divided into four phases and after every phase it will restart the server. Script phases: First Phase Enable Auto Logon Install server roles Configure WebDav Configure IIS File Extensions Configure IIS Hidden Segments Restart Server Second Phase Install additional Software Restart Server Third Phase Install Configuration Manager Restart Server Fourth Phase Install R3 and other Hotfixes Restart Server You can find more information from here : http://configmgrpsh.codeplex.com/ *********************** Author: Kaido Jarvemets Configuration Manager MVP, MCITP, MCTS Blog: Depsharee.blogspot.com
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.