Set Advertisement settings using powershell

Hi,
I need to change multiple advertisements with a powershell script. All advertisements have a mandatory assignment configured, and I need to check the "Ignore maintenance windows" and set the Rerun Behavior as "Always rerun". I created
a powershell script that read the advertisements names from a file and change each one. The problem is: When I run the script, the mandatory assignment is removed from advertisement! Any ideas how to fix it?
#Get Advertisement name from txt file
$Source = Get-Content c:\temp\AdvertName.txt
#Set counter to 0
$Count = 0
#For each advertisement in source file, change Properties as needed and increment counting
Foreach ($AdvertName in $Source)
#Connect to SCCM server using WMI and filter advertisement by name present in source file
$Advert = Get-WmiObject -ComputerName SCCMSERVER -Namespace "root\sms\site_SCCM" -class SMS_Advertisement -Filter "AdvertisementName like '$AdvertName'"
#Set AdvertFlag (OVERRIDE_SERVICE_WINDOWS+DONOT_FALLBACK+NO_DISPLAY+ONSLOWNET)
$Advert.AdvertFlag = 101842944
#Set RemoteClientFlag (DOWNLOAD_FROM_LOCAL_DISPPOINT+DOWNLOAD_FROM_REMOTE_DISPPOINT+RERUN_ALWAYS)
$Advert.RemoteClientFlags = 2128
#Apply Advertisment modification
$Advert.put()
#Increment counting by 1
$Count ++
#Write message to user with total  advertisements
Write-Host "Processed Advertisements: $Count"

You should use UPN not ALIAS
Set-SPOSiteGroup -Site https://contoso.sharepoint.com -Identity "NewGroup" -Owner <UPN>
Regards Chen V [MCTS SharePoint 2010]

Similar Messages

  • List UEFI Bios Settings Using PowerShell

    Create a file containing the uefi bios settings with values on your desktop by running this PowerShell script:
    gwmi -class Lenovo_BiosSetting -namespace root\wmi  | select currentsetting | where Currentsetting -ne "" |
    select @{label = "Name"; expression = {$_.currentsetting.split(",")[0]}}, @{label = "Value"; expression = {$_.currentsetting.split(",")[1]}} |
    Sort Name | ft -auto > $env:userprofile\desktop\"UEFI BIOS Settings.txt"

    Hi jasgud_RETSD -  Have you tried using PSEXEC?   PSExec lets you run items using the system account.  You can download psexec from the Microsoft page for Sys Internals.   Command - psexec \\localhost -s -h powershell.exe -executionPolicy bypass -Noninteractive -Noprofile -file %script%.ps1 -password %password% -file LockBIOSSetting-enable.txt -s = Run as System -h = no profile-accepteula - accepts eula I ran the your command (changing the powershell name) and confirmed you can call powershell.exe and use powershell flags (nointeractive -noprofile).   Once this to keep in mind when using psexec - the command being called (powershell.exe in this case) must be located in a directory referenced in path variables.  psexc can be executed multiple clients at once by specifying a txt file with the names of the clients you wish to target.  Multiple Clients PSEXEC @domainclients.txt -s -h powershell.exe -executionPolicy bypass -Noninteractive -Noprofile -file %script%.ps1 -password %password% -file LockBIOSSetting-enable.txt I am more insterested in getting the bios settings setup for deployments   Thanks Jeff Ragucci  

  • Set the "Schedule compliance evaluation" schedule in the default client agent settings (compliance settings) using powershell?

    I am having trouble figuring this out.  using the Set-CMClientSettings is it possible to modify the "Compliance Settings" "Schedule compliance evaluation" schedule.  The default is every 7 days and I want to be able to modify
    that.
    Thanks
    Eric

    I just checked and I don't see a way to do this even with the R2 CU1 cmdlets. I would recommend filing a feedback on Connect regarding this here:
    https://connect.microsoft.com/ConfigurationManagervnext
    Check out my Configuration Manager blog at http://aka.ms/ameltzer

  • How do I set Force Encryption using PowerShell

    I have to automate the task of setting Force Encryption (within Properties under SQL Server Configuration Manager, Network Configuration, Protocols for MSSQLSERVER). Do you know the PowerShell command to set Force Encryption to Yes? Any help would be appreciated.
    I can see some TCP configurations with this command, but I cannot see the Properties:
    $MachineObject = new-object ('Microsoft.SqlServer.Management.Smo.WMI.ManagedComputer');
    $ProtocolUri = "ManagedComputer[@Name='" + (get-item env:\computername).Value + "']/ServerInstance[@Name='MSSQLSERVER']/ServerProtocol";
    $tcp = $MachineObject.getsmoobject($ProtocolUri + "[@Name='Tcp']");$tcp;

    I had to use a registry hack to change this value. Unfortunately, it is not the best way to make changes to an SQL server:
    $RegKey = "HKLM:\Software\Microsoft\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQLServer\SuperSocketNetLib";
    Set-ItemProperty -path $RegKey -name ForceEncryption -value "1";

  • Setting Win32_DCOMApplicationSetting.RemoteServerName using Powershell

    Hello,
    I am using Windows Server 2008R2 and Powershell 3.0 (Upgrading to 4.0)
    I want to be able to set the RemoteServerName and clear the LocalService on a DCOMApplicationSetting.
    I tried:
    $dcom = Get-WMIObject -Class Win32_DCOMApplicationSetting -Filter 'Description="BCL easyPDF SDK 7 Loader"' -EnableAllPrivileges
    $dcom.RemoteServerName = "AnotherServer"
    $dcom.put()
    Which executes without error, but does not make any changes.
    I loaded up Win32_DCOMApplicationSetting in WbemTest, looked at the RemoteServerName property, and it has a write qualifier set to true.
    Where am I going wrong?
    How can I change the RemoteServerName without using the dcomcnfg gui?
    Many thanks,
    Stuart.

    you cannot change the server name.  Why would you think that this is changeable.  THis is where the DCOM app is installed
    See:
    RemoteServerName
    Data type: string
    Access type: Read-only
    Name of the remote server where the application is activated.
    http://msdn.microsoft.com/en-us/library/aa394118(v=vs.85).aspx
    ¯\_(ツ)_/¯

  • Setting Azure Website General Settings through Powershell

    Hi,
    I am looking for information on how to set the website general settings through powershell cmdlets. When I create a new Website through gallery and choose Apache Tomcat 7 it default selects the .net framework. I would like to set those off and use Java version
    Don't see any commands to set that default while creating a website. 
    Also, how can I set an SSL certificate and traffic manager end point to my website using powershell cmdlets.
    Thanks in Advance.
    Trupt

    Hi Trupt,
    Based on my research, you can configure the Type to AzureWebsite when you use
    Add-AzureTrafficManagerEndpoint or
    Set-AzureTrafficManagerEndpoint cmdlets. Although the article below is for cloud service, you can change the type and follow it:
    http://azure.microsoft.com/blog/2014/06/26/azure-traffic-manager-external-endpoints-and-weighted-round-robin-via-powershell/
    In addition, based on my experience, you can create a SSL certificate via Azure PowerShell, however, there is no way to add it to a web site in Azure PowerShell.
    Best regards,
    Susie
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact [email protected]

  • Not able to set security group without mail enabled as site collection admin using powershell in sharepoint online site - office 365

    not able to set security group without mail enabled as site collection admin using powershell in sharepoint online site - office 365?
    Any idea?

    after few days test in my lab, I can see that only email enabled group can be added as site collection admin using POWERSHELL.
    hope this helps who stuck like me!! :-)

  • How to get Document Set property values in a SharePoint library in to a CSV file using Powershell

    Hi,
    How to get Document Set property values in a SharePoint library into a CSV file using Powershell?
    Any help would be greatly appreciated.
    Thank you.
    AA.

    Hi,
    According to your description, my understanding is that you want to you want to get document set property value in a SharePoint library and then export into a CSV file using PowerShell.
    I suggest you can get the document sets properties like the PowerShell Command below:
    [system.reflection.assembly]::loadwithpartialname("microsoft.sharepoint")
    $siteurl="http://sp2013sps/sites/test"
    $listname="Documents"
    $mysite=new-object microsoft.sharepoint.spsite($siteurl)
    $myweb=$mysite.openweb()
    $list=$myweb.lists[$listname]
    foreach($item in $list.items)
    if($item.contenttype.name -eq "Document Set")
    if($item.folder.itemcount -eq 0)
    write-host $item.title
    Then you can use Export-Csv PowerShell Command to export to a CSV file.
    More information:
    Powershell for document sets
    How to export data to CSV in PowerShell?
    Using the Export-Csv Cmdlet
    Thanks
    Best Regards
    TechNet Community Support
    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact
    [email protected]

  • Is there a way to set my settings in the latest version of Firefox so I can still zoom using the trackpad?

    I have a MacBook. In previous versions of Firefox I could zoom in or out using my trackpad. Is there a way to set my settings in the latest version of Firefox so I can still zoom using the trackpad?

    Some gestures have been removed in Firefox 4.
    You can restore the zoom feature by changing the values of the related prefs on the <b>about:config</b> page.
    browser.gesture.pinch.in -> <b>cmd_fullZoomReduce</b>
    browser.gesture.pinch.in.shift -> <b>cmd_fullZoomReset</b>
    browser.gesture.pinch.out -> <b>cmd_fullZoomEnlarge</b>
    browser.gesture.pinch.out.shift -> <b>cmd_fullZoomReset</b>
    browser.gesture.pinch.latched -> <b>false</b>
    To open the <i>about:config</i> page, type <b>about:config</b> in the location (address) bar and press the "<i>Enter</i>" key, just like you type the url of a website to open a website.<br />
    If you see a warning then you can confirm that you want to access that page.<br />

  • How to set security group as primary site collection admin and secondary site collection admin using powershell in sharepoint online site - office 365?

    How to set security group as primary site collection admin and secondary site collection admin using powershell in sharepoint online site - office 365?

    Hi,
    According to your description, my understanding is that you want to set security group as admin of primary and secondary site collection using PowerShell command in office 365.
    I suggest you can use the command below to set the group to site owner, then it will have the site collection admin permission.
    Set-SPOSite -Identity https://contoso.sharepoint.com/sites/site1 -Owner [email protected] -NoWait
    Here are some detailed articles for your reference:
    https://technet.microsoft.com/en-us/library/fp161394(v=office.15)
    http://blogs.realdolmen.com/experts/2013/08/16/managing-sharepoint-online-with-powershell/
    Thanks
    Best Regards
    Jerry Guo
    TechNet Community Support

  • This message could not be delivered because your SMTP settings are not set. Please use the Accounts Preferences panel to set the SMTP options for your account.

    I am not able to send out an email. I keep getting the following message: This message could not be delivered because your SMTP settings are not set. Please use the Accounts Preferences panel to set the SMTP options for your account. Can someone help me with this?

    We need some information, starting with the email provider (eg. Google, Yahoo, Bellsouth, etc)

  • When I download Microsoft word documents (if have word 2007), I have somehow changed the settings and it downloads them in wordpad, and the format is very bad and I can't read a lot of the document. How do I change the default setting back to using Micro

    When I download Microsoft word documents (if have word 2007), I have somehow changed the settings and it downloads them in wordpad, and the format is very bad and I can't read a lot of the document. How do I change the default setting back to using Microsoft Word 2007 to open these documents?
    == This happened ==
    Every time Firefox opened
    == about a few weeks ago - I had tried to open some docuuments saved on a mac, my PC (which runs Windows 7), used word pad to open these, and this seems to have changed the default settings somehow.

    See this:
    [http://support.mozilla.com/en-US/kb/Managing+file+types]

  • How to use Powershell to set delegate for user mailbox in Exchange 2010 and Office 365

    Hello,
    Can you please tell me if I can set delegate for user mailbox in Exchange 2010 or Office 365 using Powershell?
    If I can, then how can I do that? (which Powershell commands for setting the delegate?)
    Many thanks, and have a good day!

    Hi,
    If you wanted to add a delegate to possiblly a large number of users or you do this during mailbox provisioning. So the following script will use
    impersonation to access another users mailbox and add a delegate.
    $mbtoDelegate = "[email protected]"
    $delegatetoAdd = "[email protected]"
    $dllpath = "C:\Program Files\Microsoft\Exchange\Web Services\1.0\Microsoft.Exchange.WebServices.dll"
    [void][Reflection.Assembly]::LoadFile($dllpath)
    $service = new-object Microsoft.Exchange.WebServices.Data.ExchangeService([Microsoft.Exchange.WebServices.Data.ExchangeVersion]::Exchange2007_SP1)
    $windowsIdentity = [System.Security.Principal.WindowsIdentity]::GetCurrent()
    $sidbind = "LDAP://<SID=" + $windowsIdentity.user.Value.ToString() + ">"
    $aceuser = [ADSI]$sidbind
    $service.AutodiscoverUrl($aceuser.mail.ToString())
    $service.ImpersonatedUserId = new-object Microsoft.Exchange.WebServices.Data.ImpersonatedUserId([Microsoft.Exchange.WebServices.Data.ConnectingIdType]::SmtpAddress,
    $mbtoDelegate);
    $mbMailbox = new-object Microsoft.Exchange.WebServices.Data.Mailbox($mbtoDelegate)
    $dgUser = new-object Microsoft.Exchange.WebServices.Data.DelegateUser($delegatetoAdd)
    $dgUser.ViewPrivateItems = $false
    $dgUser.ReceiveCopiesOfMeetingMessages = $false
    $dgUser.Permissions.CalendarFolderPermissionLevel = [Microsoft.Exchange.WebServices.Data.DelegateFolderPermissionLevel]::Editor
    $dgUser.Permissions.InboxFolderPermissionLevel = [Microsoft.Exchange.WebServices.Data.DelegateFolderPermissionLevel]::Reviewer
    $dgArray = new-object Microsoft.Exchange.WebServices.Data.DelegateUser[] 1
    $dgArray[0] = $dgUser
    $service.AddDelegates($mbMailbox, [Microsoft.Exchange.WebServices.Data.MeetingRequestsDeliveryScope]::DelegatesAndMe, $dgArray);
    Hope this helps.

  • How to set volume using Powershell script?

    I would like to know on how to set volume under Window 7 Home 64 bits system using Powershell script.
    Such as 8000 levels as default
    Does anyone have any suggestions?
    Thanks in advance for any suggestions
    Thanks in advance for any suggestions

    Try this.
    Function Set-SpeakerVolume{
    Param (
    [switch]$min,
    [switch]$max,
    [int]$Percent
    $wshShell = new-object -com wscript.shell
    If ($min){
    1..50 | % {$wshShell.SendKeys([char]174)}
    ElseIf ($max){
    1..50 | % {$wshShell.SendKeys([char]175)}
    elseif($Percent){
    1..50 | % {$wshShell.SendKeys([char]174)}
    1..($Percent/2) |% {$wshShell.SendKeys([char]175)}
    Else{
    $wshShell.SendKeys([char]173)
    This works in Windows 8.1.
    Stolen / Modified from
    http://blogs.technet.com/b/heyscriptingguy/archive/2013/07/28/weekend-scripter-cheesy-script-to-set-speaker-volume.aspx, which took me 20 seconds of (apparently) lucky searching.
    Karl
    When you see answers and helpful posts, please click Vote As Helpful, Propose As Answer, and/or Mark As Answer.
    My Blog: Unlock PowerShell
    My Book:
    Windows PowerShell 2.0 Bible
    My E-mail: -join ('6F6C646B61726C406F75746C6F6F6B2E636F6D'-split'(?<=\G.{2})'|%{if($_){[char][int]"0x$_"}})

  • Set user inherit permissions check box using powershell

    Hi All,
    How can I set the the  "include inherit permissions from this objects parent" propertiy in Active Directory user object to a list of users using powershell.
    This option is not checked for some of my users and I'll like to set it using a powershell script.
    Thanks
    Simon
    MCSA, MCSE, MCITP:SA, MCITP:EA, MCITP:Enterprise Messaging Administrator 2010, CCNA

    download Quest Active Directory:
     Get-QADUser -SizeLimit 0 | ? {$_.DirectoryEntry.ObjectSecurity.AreAccessRulesProtected} | Set-QADObjectSecurity -UnLockInheritance
    or 
    Get-QADUser -SizeLimit 0 | ? {$_.security.PermissionInheritanceLocked} | Set-QADObjectSecurity -UnlockInheritance
    or 
    $user = [ADSI]"LDAP://cn=kazun,ou=test,dc=contoso,dc=com"
    $acl = $ouser.objectSecurity
    $isProtected = $false # allows inheritance
    $preserveInheritance = $true # preserve inherited rules
    $acl.SetAccessRuleProtection($isProtected, $preserveInheritance)
    $user.commitchanges()
    I had this issue and using both of Kazun's methods worked. A mod should mark this as the answer.Paul Frankovich

Maybe you are looking for

  • Lagging problem when connected to a Samsung Central Station 23"

    Hi, I bought myself a Macbook Air(Summer, 2011 Edition) about 3 months ago roughly, and I also bought myself a Samsung Central Station 23" which works just as a thunderbolt or cinema display but much cheaper and much elegant. It also sends audio sign

  • SRM replenishment collaboration with Supplier consigment Material.

    Hi . Srm community. I have need to implement the funcionallity the supplier can see the stock of material in consigment. the srm standar have that functionallity or is neccesary make developments to meet .  thanks a lot .

  • Sound issue with my msi 880gm-e41 mainboard

    please help me to solve the problem as follows----------i have 5.1 speaker system and the sound is good at a medium sound range from my pc sound control,but when i increase the sound the song tends to stop and play randomly,i dont have such type of p

  • Iscripts - Need help creating a form in one

    I am confused about delimiting in iscripts. I need to create the fiollowing form: In iscript named IScript1 in function: buildform buildform has these two inputs, firstname and lastname the action of the form is also in iscript1 function getinputs is

  • LE-TRM: Error message LTRM023 when executing LROUT

    Dear all, When executing the transaction LROUT, I get the error message LTRM023 "Site is not defined". I checked table LROUT and it is actually empty. However, I created appropriate settings in maintenance views V_T340DT, V_T347A, V_LLOCT and all oth