Adding SLO using Powershell ?
Hi,
I am wondering if I can use SM Lets to manually add in SLO to a Work Item.
Why i am asking is that the SCSM workflow seem not responding while the new work items created. After we have discovered the issue, we restarted the services and everything else back to normal except the Work Item created during the problem windows do not
get SLA assign to it.
I am using the Powershell below but no luck yet.
$IRClass=Get-SCSMClass -name System.WorkItem.Incident$
$IRObject=get-scsmobject -class $IRClass
$IRTarget= $IRObject| ?{$_.id -eq "IR21199"}
#Get SLA Relationship Class
$SLAInstanceRel=Get-SCSMRelationshipClass -Name System.WorkItemHasSLAInstanceInformation
$SLAId="Response Time - 001"
$SLAInformmationHash=@{"id"=$SLAId}
New-SCSMObject -Class $SLAInstanceClass -PropertyHashtable $SLAInformmationHash
$NewSLA=Get-SCSMClass $SLAInstanceClass | Get-SCSMObject -Filter "id -eq $SLAId"
New-SCSMRelationshipObject -Relationship $SLAInstanceRel -Source $IRTarget -Target $NewSLA -Bulk
The powerShell above give me error"
New-SCSMRelationshipObject : A discovery data item was rejected because the item is already bound to another Membership relationship.
At line:1 char:1
+ New-SCSMRelationshipObject -Relationship $SLAInstanceRel -Source $IRTarget -Targ ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [New-SCSMRelationshipObject], DiscoveryDataLifetimeDependencyException
+ FullyQualifiedErrorId : Microsoft.EnterpriseManagement.Common.DiscoveryDataLifetimeDependencyException,SMLets.NewSCSMRelationshipObject
Want to know if there other alternative.
Thank you.
The "mechanic" behind SLOs and Incidents (all Work Items) in SCSM is a little bit more complicated. Maybe this blog post from Anton is helpful:
SLA in SCSM 2012. Part 2. How it's works
In general: It's not just adding a relationship between the Incident and the SLO.
Hope this helps.
Andreas Baumgarten | H&D International Group
Similar Messages
-
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 add a certificate to IIS global "Server Certificates" list using PowerShell?
Hi, been surfing the web for an example on how to add a certificate to the "global" IIS "Server Certificates" list using PowerShell but to no luck. I already have code in place on how to tie / associate a specific website with a specific cert but not how
to add the new .cer file using the "Complete Certificate Request..." wizard using PowerShell.... I dont expect the final code to become published but if someone had an idea on howto integrate / get an entry point on where to interact between the "Server Certificate"
list in IIS and POSH I would be super happy! :|
I am runnign IIS on a Windows 2008R2 x64 Standard Edition if that helps..... of course, I would saddle for an CLI if there is no other way, but POSH is of course the way to go! :)
Thanks for the help in advance guys, take care!
br4tt3Hi and thanks for the suggestions!
Although it comes close, the suggested code example points on howto import / incorporate .pfx files - I am getting fed by .cer files which I need to add into the IIS console using POSH.
I tried explore the IIS.CertObj object but was not able to work out if this one could be used for importing / adding .cer files into IIS! However, launching the following command from a POSH console with Import-Module Webadministration already
loaded into that shell;
$certMgr = New-Object -ComObject IIS.CertObj returns the following error message:
New-Object : Cannot load COM type IIS.CertObj
From an IIS perspective I have the following components installed;
[X] Web Server (IIS) Web-Server
[X] Web Server Web-WebServer
[ ] Common HTTP Features Web-Common-Http
[ ] Static Content Web-Static-Content
[ ] Default Document Web-Default-Doc
[ ] Directory Browsing Web-Dir-Browsing
[ ] HTTP Errors Web-Http-Errors
[ ] HTTP Redirection Web-Http-Redirect
[ ] WebDAV Publishing Web-DAV-Publishing
[X] Application Development Web-App-Dev
[ ] ASP.NET
Web-Asp-Net
[X] .NET Extensibility Web-Net-Ext
[ ] ASP
Web-ASP
[ ] CGI
Web-CGI
[ ] ISAPI Extensions Web-ISAPI-Ext
[ ] ISAPI Filters Web-ISAPI-Filter
[ ] Server Side Includes Web-Includes
[ ] Health and Diagnostics Web-Health
[ ] HTTP Logging Web-Http-Logging
[ ] Logging Tools Web-Log-Libraries
[ ] Request Monitor Web-Request-Monitor
[ ] Tracing
Web-Http-Tracing
[ ] Custom Logging Web-Custom-Logging
[ ] ODBC Logging Web-ODBC-Logging
[X] Security
Web-Security
[ ] Basic Authentication Web-Basic-Auth
[ ] Windows Authentication Web-Windows-Auth
[ ] Digest Authentication Web-Digest-Auth
[ ] Client Certificate Mapping Authentic... Web-Client-Auth
[ ] IIS Client Certificate Mapping Authe... Web-Cert-Auth
[ ] URL Authorization Web-Url-Auth
[X] Request Filtering Web-Filtering
[ ] IP and Domain Restrictions Web-IP-Security
[ ] Performance Web-Performance
[ ] Static Content Compression Web-Stat-Compression
[ ] Dynamic Content Compression Web-Dyn-Compression
[X] Management Tools Web-Mgmt-Tools
[X] IIS Management Console Web-Mgmt-Console
[X] IIS Management Scripts and Tools Web-Scripting-Tools
[ ] Management Service Web-Mgmt-Service
[ ] IIS 6 Management Compatibility Web-Mgmt-Compat
[ ] IIS 6 Metabase Compatibility Web-Metabase
[ ] IIS 6 WMI Compatibility Web-WMI
[ ] IIS 6 Scripting Tools Web-Lgcy-Scripting
[ ] IIS 6 Management Console Web-Lgcy-Mgmt-Console
[X] FTP Server Web-Ftp-Server
[X] FTP Service Web-Ftp-Service
[X] FTP Extensibility Web-Ftp-Ext
[ ] IIS Hostable Web Core Web-WHC
More or less the one thing that I am trying to get up and running is an automated FTPS solution - I just use the IIS console to be able to troubleshoot / compare how things scripted from POSH interacts in the MMC representation. The error I am getting
might be that I am lacking some IIS components to be in place to be able to automate some parts of the IIS - as suggested by the IIS.CertObj object listed in the example..... I will get back if I can track down which component needs to be added to be
able to reference the IIS.CertObj object.
Br4tt3 signing out...
br4tt3 -
How to add multiple users permissions to a calendar using powershell?
I have an organization that was recently setup in Exchange Online and they have unique circumstances in that every user in the organization needs "reviewer"
access to every other users calendars. I cannot change the default permission since new users added after this should not be able to see these calendars details. There are a few I will go back to run a Set command on to change an individual permission
here and there for specific needs, but the main need is below.
I have basic experience with powershell commands and have found how to manually add a single users permissions to a calendar using the command below:
Add-MailboxFolderPermission -Identity alias:\calendar -user alias -AccessRights reviewer
Since it's not realistic to run this command thousands of times changing the user aliases each time, I was hoping someone could help me build a command to run on a single mailbox's calendar that would add every current user in the organization with certain
permissions such as "reviewer" or "availabilityonly".
Thanks for the help!Hi,
A possible solution is to do this via Security Groups.
Add-MailboxFolderPermission -Identity [email protected]:\Calendar -User [email protected] -AccessRights Owner
This way, you simply add users that require access to the CalendarOwnerAccessGroup
You still have to run this on every mailbox that should have this feature, but that could be solved using powershell piping.
http://technet.microsoft.com/en-us/library/ee176927.aspx
/Anders Eide -
How to add calendar enries to all users in organization using powershell and EWS.
I am one of the exchange admins for our organization. Every year, we publish academic calendar data to all faculty and staff calendars. We recently updated and migrated from Exchange 2003 to Exchange 2010 which, of course, desupported MAPI and
ADO. The processes we previously used had to be re-written using Exchange Web Services API (EWS). Because I find that powershell is easy to work with, I wanted to integrate the calendar dispersal using powershell.
Having not found much help online using the EWS .NET library in powershell for this purpose, I decided to share my code:
# Bulk load calendar entries script
# Description:
# Script used to deploy Academic Calendar entries to all Exchange account calendars
# Prerequisites:
# Service account must have ApplicationImpersonation ManagementRoleAddisgnment
# New-ManagementRoleAssignment -Name:impersonationRole -Role:ApplicationImpersonation -User:<srv_account>
# Usage:
# .\academicCalendar.ps1 calEntries.csv
# Where calEntries.csv = list of calendar entries to add
Param ([string]$calInputFile = $(throw "Please provide calendar input file parameter..."))
$startTime = Get-Date
$strFileName = "<path to log file>"
if(Test-Path $strFileName)
$logOutFile = Get-Item -path $strFileName
else
$logOutFile = New-Item -type file $strFileName
# Load EWS Managed API library
Import-Module -Name "C:\Program Files\Microsoft\Exchange\Web Services\1.0\Microsoft.Exchange.WebServices.dll"
# Load all Mailboxes
$exchangeUsers = Get-Mailbox -ResultSize Unlimited | Select PrimarySmtpAddress
# Load all calendar Entries
# Input file is in the following format
# StartDate,EndDate,Subject
# 8/29/2011,8/30/2011,First Day of Fall Classes
$calEntries = Import-Csv $calInputFile
# Setup the service for connection
$service = new-object Microsoft.Exchange.WebServices.Data.ExchangeService([Microsoft.Exchange.WebServices.Data.ExchangeVersion]::Exchange2010)
$service.Url = new-object System.Uri("https://<CAS_server_URL>/ews/exchange.asmx")
$service.Credentials = new-object Microsoft.Exchange.WebServices.Data.WebCredentials("<service_account>","<password>","<domain>")
$totalCount = $exchangeUsers.Count
$currentCount = 0
Write-Output "Exchange Version: $service.RequestedServerVersion"
Write-Output "Mailbox Count: $totalCount"
# Add message to log file
$timeStamp = Get-Date -Format "MM/dd/yyyy hh:mm:ss"
$message = "$timeStamp -- Begin Calendar Deployment `n"
$message += "Total Exchange Accounts: $totalCount"
Add-Content $logOutFile $message
# Perform for each Mailbox
$error.clear()
foreach($mailbox in $exchangeUsers)
$currentCount++
if($mailbox.PrimarySmtpAddress -ne "")
# Output update to screen
$percentComplete = $currentCount/$totalCount
Write-Output $mailbox.PrimarySmtpAddress
"{0:P0}" -f $percentComplete
# Setup mailbox parameters for impersonation
$MailboxName = $mailbox.PrimarySmtpAddress
$iUserID = new-object Microsoft.Exchange.WebServices.Data.ImpersonatedUserId([Microsoft.Exchange.WebServices.Data.ConnectingIdType]::SmtpAddress,$MailboxName)
$service.ImpersonatedUserId = $iUserID
# Indicate which folder to work with
$folderid = new-object Microsoft.Exchange.WebServices.Data.FolderId([Microsoft.Exchange.WebServices.Data.WellKnownFolderName]::Calendar)
$CalendarFolder = [Microsoft.Exchange.WebServices.Data.CalendarFolder]::Bind($service,$folderid)
# For each entry in the input file
$error.clear()
foreach($entry in $calEntries)
# First check to make sure the entry is not already in the calendar
# use a calendarview object to pull the entries for the given date and make sure an entry with the same subject line doesnt already exist
$cvCalendarview = new-object Microsoft.Exchange.WebServices.Data.CalendarView([System.DateTime]($entry.StartDate),[System.DateTime]($entry.EndDate))
$cvCalendarview.PropertySet = new-object Microsoft.Exchange.WebServices.Data.PropertySet([Microsoft.Exchange.WebServices.Data.BasePropertySet]::FirstClassProperties)
$frCalendarResult = $CalendarFolder.FindAppointments($cvCalendarview)
$entryFound = $False
foreach ($appointment in $frCalendarResult.Items)
if($appointment.Subject -eq $entry.Subject)
$entryFound = $True
# If entry was found, then skip this entry
if($entryFound)
$entryFound = $False
else # Create the appointment object and save it to the users calendar
$appt = New-Object Microsoft.Exchange.WebServices.Data.Appointment($service)
$appt.Subject = $entry.Subject
$appt.Start = [System.DateTime]($entry.StartDate)
$appt.End = [System.DateTime]($entry.EndDate) #For AllDayEvent, end date must be after start date
$appt.IsAllDayEvent = $True #Set event as "All Day Event"
$appt.LegacyFreeBusyStatus = "Free" #Make sure free/busy info shows user as "free" rather than "busy"
$appt.IsReminderSet = $False #Make sure reminder is not set to remind the user of the event
$appt.Save([Microsoft.Exchange.WebServices.Data.SendInvitationsMode]::SendToNone)
if($error)
$timeStamp = Get-Date -Format "MM/dd/yyyy hh:mm:ss"
$message = $timeStamp + "...Exception Occurred while processing Save for: `n"
$message += " Account: " + $MailboxName + "`n"
$message += " Subject: " + $entry.Subject + "`n"
$message += " Exception: " + $error[0].Exception + "`n"
Add-Content $logOutFile $message
$error.clear()
if($error)
$error.clear()
else
$message = "" + $MailboxName + "`t Success! `n"
Add-Content $logOutFile $message
Write-Output $currentCount
$endTime = Get-Date
$duration = New-TimeSpan $startTime $endTime
$totalMin = $duration.TotalMinutes
# Build and send email notification upon completion
$body = "The Calendar deployment has completed. `n `n "
$body += "Start Timestamp: $startTime `n "
$body += "End Timestamp: $endTime `n "
$body += "Duration: $totalMin min `n "
$body += "Exchange accounts affected: $currentCount `n"
$smtpServer = "<mysmtpserver>"
$smtp = new-object Net.Mail.SmtpClient($smtpServer)
$msg = new-object Net.Mail.MailMessage
$msg.From = "<from_email_address>"
$msg.To.Add("<to_email_address>")
$msg.Subject = "Calendar Deployment"
$msg.Body = $body
$smtp.Send($msg)
# Add closing message to log file
$timeStamp = Get-Date -Format "MM/dd/yyyy hh:mm:ss"
$message = "Accounts affected: $currentCount"
Add-Content $logOutFile $message
$message = "$timeStamp -- Completed in $totalMin min."
Add-Content $logOutFile $message
Please let me know if you think I can make any performance modifications.
Daniel
--Edit-- I have updated the script for Exchange 2010 SP1, also added logging, error checking and email notifications. This new script also checks first to make sure the appointment doesn't already exist before adding it. (To prevent multiple
entries of the same event... Note: This check, although necessary in my opinion, is very time consuming.)Hi Daniel
I am trying to add addition propertires like TV, Copier etc. to Room Mailbox in Exchange 2010 using following commands:-
[PS] C:\Windows\system32>$ResourceConfiguration = Get-ResourceConfig
[PS] C:\Windows\system32>$ResourceConfiguration.ResourcePropertySchema+=("Room/Whiteboard")
Upper two commands run fine but following command gives error:-
[PS] C:\Windows\system32>Set-ResourceConfig -ResourcePropertySchema $ResourceConfiguration.ResourcePropertySchema
The term 'Set-ResourceConfig' is not recognized as the name of a cmdlet, function, script file, or operable program. Ch
eck the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:19
+ Set-ResourceConfig <<<< -ResourcePropertySchema $ResourceConfiguration.ResourcePropertySchema
+ CategoryInfo : ObjectNotFound: (Set-ResourceConfig:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
I also tried with space after set but still getting error:
[PS] C:\Windows\system32>Set -ResourceConfig -ResourcePropertySchema $ResourceConfiguration.ResourcePropertySchema
Set-Variable : A parameter cannot be found that matches parameter name 'ResourceConfig'.
At line:1 char:20
+ Set -ResourceConfig <<<< -ResourcePropertySchema $ResourceConfiguration.ResourcePropertySchema
+ CategoryInfo : InvalidArgument: (:) [Set-Variable], ParameterBindingException
+ FullyQualifiedErrorId : NamedParameterNotFound,Microsoft.PowerShell.Commands.SetVariableCommand
Pl advise the solution at [email protected] . I got this help from
http://zbutler.wordpress.com/2010/03/17/adding-additional-properties-to-resource-mailboxes-exchange-2010/ -
Uploading document using Powershell is throwing error- There is no file with URL
Hi.
I am trying to upload multiple documents to a sub folder in a library using powershell.
I am getting the error as : ForEach-Object : Exception calling "Add" with "3" argument(s):
"<nativehr>0x80070003</nativehr><nativestack></nativestack>There is no file
with URL 'server/TestLibrary/User_image/ab_3f_wht_ist_small_gif.gif' in this Web."
I have used the below code:
function UploadImages($weburl)
$docLibraryName = "TestLibrary"
$localFolderPath = "C:\Users\Imgs\user_image"
Add-PsSnapin Microsoft.SharePoint.PowerShell -erroraction silentlycontinue
$web = Get-SPWeb -Identity $webUrl
$docLibrary = $web.Lists[$docLibraryName]
$subFolderName="user_image"
Add-PsSnapin Microsoft.SharePoint.PowerShell -erroraction silentlycontinue
$web = Get-SPWeb -Identity $webUrl
$docLibrary = $web.Lists[$docLibraryName]
#Attach to local folder and enumerate through all files
$files = ([System.IO.DirectoryInfo] (Get-Item $localFolderPath)).GetFiles() | ForEach-Object {
#Create file stream object from file
$fileStream = ([System.IO.FileInfo] (Get-Item $_.FullName)).OpenRead()
$contents = new-object byte[] $fileStream.Length
$fileStream.Read($contents, 0, [int]$fileStream.Length);
$fileStream.Close();
write-host "Copying" $_.Name "to" $docLibrary.Title "in" $web.Title "..."
#Add file
$folder = $web.getfolder($docLibrary.Title + "/" + $subFolderName)
write-host "folder is " $folder
$spFile = $folder.Files.Add($folder.Url + "/" + $_.Name, $contents, $true)
$spItem = $spFile.Item
Write-Host -f Green "Added Images to Library !!!"
$web.Dispose()
How to fix this?
ThanksHI,
Is the name of the image or the sub folder name the issue?
I have the images with the name as "ab_3f_wht_ist_small_gif.gif". folder name "User_image"
There are underscores on the file name, but there is no space. When I add the file from the library (using the UI), the image is getting added.
But adding through the powershell is giving the issue.
I have checked this:
http://social.msdn.microsoft.com/Forums/sharepoint/en-US/e810ad03-81ef-4fa6-aab8-ddc896a13ebf/getting-error-during-uploading-a-document-using-powershell?forum=sharepointdevelopmentprevious
but did not help.
Thanks -
How can I define a name in Excel using Powershell?
I know how to reference existing names using the RANGE function but how can I create a new defined name using Powershell?
My specific case involves defining a name for a single cell with a workbook scope. Just as if you were to right-click a cell in Excel and choose Define Name.
The closest I've gotten is the NAMES object for the workbook but when I "gm" that all I see is a method for delete - nothing for adding.
$xlsx = "c:\Sample.xlsx"
$excel = new-object -comobject Excel.Application
$xlb = $excel.Workbooks.Open($xlsx)
$xlb.names | gmIn Excel a Range has a name. You can create a range and name it. "Names" is just a list of the names that have been defined.
So what is it that you are asking? If your spreadsheet has names this will find them for you.
Try this:
$xlb.names|select name
$r=$xlb.sheets.item(1).UsedRange
$r.Name='all'
# now do this again
$xlb.names|select name
So now you know everything about "names" or, as us old pros say "named ranges" like in the old west.
¯\_(ツ)_/¯ -
How to add hash table values to SQL Table using Powershell
Hi,
I have sharepoint list with four(column1, column2, column3,column4)columns.I am reading the list column values and adding to hashtable. Now I want to add values from hastable to SQL table with four(column1, column2, colum3,column4)columns using powershell.
I have written the following script for single column but I would like to know how to add values for multiple columns.
if(($key -eq "Column1") )
$SqlQuery = "INSERT INTO [TableName] ([Column1]) VALUES ('" + $HashTable.Item($key) +"')"
#Set new object to connect to sql database
$connection = new-object system.data.sqlclient.sqlconnection
$Connection.ConnectionString ="server=SQLServerName;database=SQLDBName;Integrated Security = True;"
$connection #List connection information
$connection.open() #Open Connection
$Cmd = New-Object System.Data.SqlClient.SqlCommand
$Cmd.CommandText = $SqlQuery
$Cmd.Connection = $connection
$SqlAdapter = New-Object System.Data.SqlClient.SqlDataAdapter
$SqlAdapter.SelectCommand = $SqlCmd
$DataSet = New-Object System.Data.DataSet
$SqlAdapter.Fill($DataSet)
$DataSet.Tables[0]
$connection.Close()
Can anybody please help me out to accomplish the task? Any help would be greatly appreciated.
AA.Hi AOk2013,
Not knowledgable on PowercShell, based on my understanding on HashTable in Java, Some modification you can make in your code to achieve your requirement.
If the Keys in HashTable are "Column1","Column2","Column3","Column4", you can reference below.
if(($key -eq "Column1") ) #what is the purposed of this if ?
#$SqlQuery = "INSERT INTO [TableName] ([Term]) VALUES ('" + $HashTable.Item($key) +"')"
#specify the real column names in the table
$SqlQuery = "INSERT INTO [TableName] ([ColumnA],[ColumnB],[ColumnC],[ColumnD]) VALUES ('" + $HashTable.Item("Column1") +"','"+ $HashTable.Item("Column2") +"','"+$HashTable.Item("Column3") +"','"+$HashTable.Item("Column4") +"')"
#Set new object to connect to sql database
$connection = new-object system.data.sqlclient.sqlconnection
$Connection.ConnectionString ="server=SQLServerName;database=SQLDBName;Integrated Security = True;"
$connection #List connection information
$connection.open() #Open Connection
$Cmd = New-Object System.Data.SqlClient.SqlCommand
$Cmd.CommandText = $SqlQuery
$Cmd.Connection = $connection
$SqlAdapter = New-Object System.Data.SqlClient.SqlDataAdapter
$SqlAdapter.SelectCommand = $SqlCmd
$DataSet = New-Object System.Data.DataSet
$SqlAdapter.Fill($DataSet)
$DataSet.Tables[0]
$connection.Close()
Since your question is regarding PowerShell, I would suggest you post it in a dedicated
PowerShell Forum. It is more appropriate and more experts will assist you.
If you have any feedback on our support, you can click
here.
Eric Zhang
TechNet Community Support -
Feature not appearing in site collection features list using powershell
I created a custom web part solution which adds a custom web part to the web part gallery - simple.
I did this on my dev server and used Visual Studio's deploy button to deploy it, and it all worked. The solution was added to the Solution Store, my feature was now in the Site Collection features list and automatically activated. So I checked my web part
gallery and it was there as well... great.
Now I'm ready to migrate my simple web part to my Prod server. I managed to use WSP builder to build my wsp. So now i have my wsp file.
I used Powershell to add my solution to my Prod server, that worked. So I ran the Install-SPSolution command and looking at the logs, it all seemed to install fine. Here are the commands I used:
Add-SPSolution “E:\Deployment WSPs\HRFeedbackForm.wsp“
Install-SPSolution -Identity "HRFeedbackForm.wsp" -GACDeployment
However, when I go to my Site Collection Features, I can't see my feature. There is nothing in my 14 hive either and as far as I can see, and there are no errors in my log files.
So what have I done wrong?
So I tested adding and deploying the same solution on my dev box using Powershell and I had the same problem as what I've experienced on my Prod server. So what's the difference between deploying solutions via Visual Studio Deploy and using those powershell
commands??? Is there something else I'm meant to change, somewhere?
I hope someone can shed some light on this issue.
Danielle :)Hi,
I wonder whether you have to populate this web part by force in your web part gallery.
For this, go to your Site's Home page. Then...
Site Action > Site Settings > Galleries > Web Parts
From here...
Under Library Tools go to Documents Tab > Click on New Documents > The New Web Parts popup will open
Here search for your web part. If you find it, select it and Check "Overwrite if file already exisists" and click on Populate Gallery.
If the above does not work, I am stumped too. I will be curious what other members of the community have to add.
Thanks, Soumya | MCITP, SharePoint 2010
Omg it was there and i've added it to the web parts library and it works.... that was soooo strange.
Thanks Soumya :)
Can you explain at all why the web part has been added to the web part gallery, but the feature doesn't appear under site collection features?
Danielle :) -
How to Create Windows Firewall Predefined rules using Powershell
Windows Firewall Predefined rules using Powershell
Following commands are working some time however sometimes it's giving errors. Any help would be appreciated
WORKING ==> Set-NetFirewallRule -DisplayGroup "File and Printer Sharing" -Enabled True
Set-NetFirewallRule -DisplayGroup "File and Printer Sharing" -Enabled True -Direction Inbound
NOT WORKING
PS C:\Windows\system32> Set-NetFirewallRule -DisplayGroup "File and Printer Sharing" -Enabled True -Direction Outbound
Set-NetFirewallRule : One of the port keywords is invalid.
At line:1 char:1
+ Set-NetFirewallRule -DisplayGroup "File and Printer Sharing" -Enabled True -Dire ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (MSFT_NetFirewal...ystemName = ""):root/standardcimv2/MSFT_NetFirewallRule) [Se
t-NetFirewallRule], CimException
+ FullyQualifiedErrorId : HRESULT 0x80070057,Set-NetFirewallRule
PS C:\Windows\system32> Set-NetFirewallRule -DisplayGroup "File and Printer Sharing" -Enabled True -Direction Outbound
Set-NetFirewallRule : One of the port keywords is invalid.
At line:1 char:1
+ Set-NetFirewallRule -DisplayGroup "File and Printer Sharing" -Enabled True -Dire ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (MSFT_NetFirewal...ystemName = ""):root/standardcimv2/MSFT_NetFirewallRule) [Se
t-NetFirewallRule], CimException
+ FullyQualifiedErrorId : HRESULT 0x80070057,Set-NetFirewallRule
Anoop C Nair (My Blog www.AnoopCNair.com)
- Twitter @anoopmannur -
FaceBook Forum For SCCMThe command:
Get-NetFirewallRule -DisplayGroup "File and Printer Sharing" -Direction Outbound
produces the output:
Name : FPS-NB_Session-In-TCP
DisplayName : File and Printer Sharing (NB-Session-In)
Description : Inbound rule for File and Printer Sharing to allow NetBIOS Session Service connections. [TCP 139]
DisplayGroup : File and Printer Sharing
Group : @FirewallAPI.dll,-28502
Enabled : True
Profile : Any
Platform : {}
Direction : Outbound
Action : Allow
EdgeTraversalPolicy : Block
LooseSourceMapping : False
LocalOnlyMapping : False
Owner :
PrimaryStatus : OK
Status : The rule was parsed successfully from the store. (65536)
EnforcementStatus : NotApplicable
PolicyStoreSource : PersistentStore
PolicyStoreSourceType : Local
Name : FPS-NB_Session-Out-TCP
DisplayName : File and Printer Sharing (NB-Session-Out)
Description : Outbound rule for File and Printer Sharing to allow NetBIOS Session Service connections. [TCP 139]
DisplayGroup : File and Printer Sharing
Group : @FirewallAPI.dll,-28502
Enabled : True
Profile : Any
Platform : {}
Direction : Outbound
Action : Allow
EdgeTraversalPolicy : Block
LooseSourceMapping : False
LocalOnlyMapping : False
Owner :
PrimaryStatus : OK
Status : The rule was parsed successfully from the store. (65536)
EnforcementStatus : NotApplicable
PolicyStoreSource : PersistentStore
PolicyStoreSourceType : Local
Name : FPS-SMB-In-TCP
DisplayName : File and Printer Sharing (SMB-In)
Description : Inbound rule for File and Printer Sharing to allow Server Message Block transmission and reception via Named Pipes. [TCP 445]
DisplayGroup : File and Printer Sharing
Group : @FirewallAPI.dll,-28502
Enabled : True
Profile : Any
Platform : {}
Direction : Outbound
Action : Allow
EdgeTraversalPolicy : Block
LooseSourceMapping : False
LocalOnlyMapping : False
Owner :
PrimaryStatus : OK
Status : The rule was parsed successfully from the store. (65536)
EnforcementStatus : NotApplicable
PolicyStoreSource : PersistentStore
PolicyStoreSourceType : Local
Name : FPS-SMB-Out-TCP
DisplayName : File and Printer Sharing (SMB-Out)
Description : Outbound rule for File and Printer Sharing to allow Server Message Block transmission and reception via Named Pipes. [TCP 445]
DisplayGroup : File and Printer Sharing
Group : @FirewallAPI.dll,-28502
Enabled : True
Profile : Any
Platform : {}
Direction : Outbound
Action : Allow
EdgeTraversalPolicy : Block
LooseSourceMapping : False
LocalOnlyMapping : False
Owner :
PrimaryStatus : OK
Status : The rule was parsed successfully from the store. (65536)
EnforcementStatus : NotApplicable
PolicyStoreSource : PersistentStore
PolicyStoreSourceType : Local
Name : FPS-NB_Name-In-UDP
DisplayName : File and Printer Sharing (NB-Name-In)
Description : Inbound rule for File and Printer Sharing to allow NetBIOS Name Resolution. [UDP 137]
DisplayGroup : File and Printer Sharing
Group : @FirewallAPI.dll,-28502
Enabled : True
Profile : Any
Platform : {}
Direction : Outbound
Action : Allow
EdgeTraversalPolicy : Block
LooseSourceMapping : False
LocalOnlyMapping : False
Owner :
PrimaryStatus : OK
Status : The rule was parsed successfully from the store. (65536)
EnforcementStatus : NotApplicable
PolicyStoreSource : PersistentStore
PolicyStoreSourceType : Local
Name : FPS-NB_Name-Out-UDP
DisplayName : File and Printer Sharing (NB-Name-Out)
Description : Outbound rule for File and Printer Sharing to allow NetBIOS Name Resolution. [UDP 137]
DisplayGroup : File and Printer Sharing
Group : @FirewallAPI.dll,-28502
Enabled : True
Profile : Any
Platform : {}
Direction : Outbound
Action : Allow
EdgeTraversalPolicy : Block
LooseSourceMapping : False
LocalOnlyMapping : False
Owner :
PrimaryStatus : OK
Status : The rule was parsed successfully from the store. (65536)
EnforcementStatus : NotApplicable
PolicyStoreSource : PersistentStore
PolicyStoreSourceType : Local
Name : FPS-NB_Datagram-In-UDP
DisplayName : File and Printer Sharing (NB-Datagram-In)
Description : Inbound rule for File and Printer Sharing to allow NetBIOS Datagram transmission and reception. [UDP 138]
DisplayGroup : File and Printer Sharing
Group : @FirewallAPI.dll,-28502
Enabled : True
Profile : Any
Platform : {}
Direction : Outbound
Action : Allow
EdgeTraversalPolicy : Block
LooseSourceMapping : False
LocalOnlyMapping : False
Owner :
PrimaryStatus : OK
Status : The rule was parsed successfully from the store. (65536)
EnforcementStatus : NotApplicable
PolicyStoreSource : PersistentStore
PolicyStoreSourceType : Local
Name : FPS-NB_Datagram-Out-UDP
DisplayName : File and Printer Sharing (NB-Datagram-Out)
Description : Outbound rule for File and Printer Sharing to allow NetBIOS Datagram transmission and reception. [UDP 138]
DisplayGroup : File and Printer Sharing
Group : @FirewallAPI.dll,-28502
Enabled : True
Profile : Any
Platform : {}
Direction : Outbound
Action : Allow
EdgeTraversalPolicy : Block
LooseSourceMapping : False
LocalOnlyMapping : False
Owner :
PrimaryStatus : OK
Status : The rule was parsed successfully from the store. (65536)
EnforcementStatus : NotApplicable
PolicyStoreSource : PersistentStore
PolicyStoreSourceType : Local
Name : FPS-ICMP4-ERQ-In
DisplayName : File and Printer Sharing (Echo Request - ICMPv4-In)
Description : Echo Request messages are sent as ping requests to other nodes.
DisplayGroup : File and Printer Sharing
Group : @FirewallAPI.dll,-28502
Enabled : True
Profile : Any
Platform : {}
Direction : Outbound
Action : Allow
EdgeTraversalPolicy : Block
LooseSourceMapping : False
LocalOnlyMapping : False
Owner :
PrimaryStatus : OK
Status : The rule was parsed successfully from the store. (65536)
EnforcementStatus : NotApplicable
PolicyStoreSource : PersistentStore
PolicyStoreSourceType : Local
Name : FPS-ICMP4-ERQ-Out
DisplayName : File and Printer Sharing (Echo Request - ICMPv4-Out)
Description : Echo Request messages are sent as ping requests to other nodes.
DisplayGroup : File and Printer Sharing
Group : @FirewallAPI.dll,-28502
Enabled : True
Profile : Any
Platform : {}
Direction : Outbound
Action : Allow
EdgeTraversalPolicy : Block
LooseSourceMapping : False
LocalOnlyMapping : False
Owner :
PrimaryStatus : OK
Status : The rule was parsed successfully from the store. (65536)
EnforcementStatus : NotApplicable
PolicyStoreSource : PersistentStore
PolicyStoreSourceType : Local
Name : FPS-ICMP6-ERQ-In
DisplayName : File and Printer Sharing (Echo Request - ICMPv6-In)
Description : Echo Request messages are sent as ping requests to other nodes.
DisplayGroup : File and Printer Sharing
Group : @FirewallAPI.dll,-28502
Enabled : True
Profile : Any
Platform : {}
Direction : Outbound
Action : Allow
EdgeTraversalPolicy : Block
LooseSourceMapping : False
LocalOnlyMapping : False
Owner :
PrimaryStatus : OK
Status : The rule was parsed successfully from the store. (65536)
EnforcementStatus : NotApplicable
PolicyStoreSource : PersistentStore
PolicyStoreSourceType : Local
Name : FPS-ICMP6-ERQ-Out
DisplayName : File and Printer Sharing (Echo Request - ICMPv6-Out)
Description : Echo Request messages are sent as ping requests to other nodes.
DisplayGroup : File and Printer Sharing
Group : @FirewallAPI.dll,-28502
Enabled : True
Profile : Any
Platform : {}
Direction : Outbound
Action : Allow
EdgeTraversalPolicy : Block
LooseSourceMapping : False
LocalOnlyMapping : False
Owner :
PrimaryStatus : OK
Status : The rule was parsed successfully from the store. (65536)
EnforcementStatus : NotApplicable
PolicyStoreSource : PersistentStore
PolicyStoreSourceType : Local
Name : FPS-LLMNR-In-UDP
DisplayName : File and Printer Sharing (LLMNR-UDP-In)
Description : Inbound rule for File and Printer Sharing to allow Link Local Multicast Name Resolution. [UDP 5355]
DisplayGroup : File and Printer Sharing
Group : @FirewallAPI.dll,-28502
Enabled : True
Profile : Any
Platform : {}
Direction : Outbound
Action : Allow
EdgeTraversalPolicy : Block
LooseSourceMapping : False
LocalOnlyMapping : False
Owner :
PrimaryStatus : OK
Status : The rule was parsed successfully from the store. (65536)
EnforcementStatus : NotApplicable
PolicyStoreSource : PersistentStore
PolicyStoreSourceType : Local
Name : FPS-LLMNR-Out-UDP
DisplayName : File and Printer Sharing (LLMNR-UDP-Out)
Description : Outbound rule for File and Printer Sharing to allow Link Local Multicast Name Resolution. [UDP 5355]
DisplayGroup : File and Printer Sharing
Group : @FirewallAPI.dll,-28502
Enabled : True
Profile : Any
Platform : {}
Direction : Outbound
Action : Allow
EdgeTraversalPolicy : Block
LooseSourceMapping : False
LocalOnlyMapping : False
Owner :
PrimaryStatus : OK
Status : The rule was parsed successfully from the store. (65536)
EnforcementStatus : NotApplicable
PolicyStoreSource : PersistentStore
PolicyStoreSourceType : Local
The command:
(Get-NetFirewallRule -DisplayGroup "File and Printer Sharing" -Direction Outbound).DisplayName
shows the display names of the 14 outbound rules in the FPS group:
File and Printer Sharing (NB-Session-In)
File and Printer Sharing (NB-Session-Out)
File and Printer Sharing (SMB-In)
File and Printer Sharing (SMB-Out)
File and Printer Sharing (NB-Name-In)
File and Printer Sharing (NB-Name-Out)
File and Printer Sharing (NB-Datagram-In)
File and Printer Sharing (NB-Datagram-Out)
File and Printer Sharing (Echo Request - ICMPv4-In)
File and Printer Sharing (Echo Request - ICMPv4-Out)
File and Printer Sharing (Echo Request - ICMPv6-In)
File and Printer Sharing (Echo Request - ICMPv6-Out)
File and Printer Sharing (LLMNR-UDP-In)
File and Printer Sharing (LLMNR-UDP-Out)
If your output is different than this, it means rules have been removed (or added) to the File and Print Sharing group.
For example, if you run the command:
New-NetFirewallRule -DisplayName "My test rule 2" -group "File and Printer Sharing" -Enabled True -Protocol tcp -LocalPort 12346 -Direction Inbound
This adds a new inbound firewall rule to the FPS group. Output looks like:
Name : {06449724-944b-4048-834f-8870b9dce4f6}
DisplayName : My test rule 2
Description :
DisplayGroup : File and Printer Sharing
Group : File and Printer Sharing
Enabled : True
Profile : Any
Platform : {}
Direction : Inbound
Action : Allow
EdgeTraversalPolicy : Block
LooseSourceMapping : False
LocalOnlyMapping : False
Owner :
PrimaryStatus : OK
Status : The rule was parsed successfully from the store. (65536)
EnforcementStatus : NotApplicable
PolicyStoreSource : PersistentStore
PolicyStoreSourceType : Local
This test rule is of course useless because there's no listener on TCP port 12346 on this particular machine..
The new rule can also be viewed in Windows Firewall with Advanced Security:
Now if you run the command:
(Get-NetFirewallRule -DisplayGroup "File and Printer Sharing" -Direction Inbound).DisplayName
the output will look like:
File and Printer Sharing (Spooler Service - RPC)
File and Printer Sharing (Spooler Service - RPC-EPMAP)
My test rule 2
Sam Boutros, Senior Consultant, Software Logic, KOP, PA http://superwidgets.wordpress.com (Please take a moment to Vote as Helpful and/or Mark as Answer, where applicable) -
Use Powershell to replace text with image in Word document
I have a powershell script that uses a Word document as a template to create signatures that I am pushing out to my organization.
The document is populated with text formatted the way I want the signature to look, that I then do a FindText and ReplaceText on. This works fine for replacing text with text, but I can't figure out how to properly replace some of the holder text with
an image and a link. I found a few posts about adding images to word documents, but none that seem to work properly in this scenario.
Any insight would be greatly appreciated, thanks!Dear BOFH,
You are correct that method I outlined is not for inserting an image into a signature block (which would be in Outlook, not Word). The links you post do certainly deal with outlook signatures, well done... Except that the question was about how to
use a Powershell script to replace text in a Word document with an image. Sure it was framed in the context of creating signatures, but the poster expressed that they already had a method of generating and replacing text, and just needed to know, as
I did, how to do the thing they actually asked.
Please BOFH... Please forgive my audacity in hoping to find a reference (any reference) to how to replace Word text with images via Powershell in a thread titled "Use Powershell to replace text with image in Word document".
This is certainly a scripting question, and even something as simple as "You will need to call the .NET methods for the Word find/replace functionality. Please ask in the Word forums for the correct method to use.
If you need help on calling .NET methods look HTTP ://here"support you offered combined with the contempt you offer in response to my actual substantive help to the actual question asked.
BOFH, you are not better than us, just more arrogant.
Can you please start your own question as this one has been closed. Please see scripting guidelines.
We cannot guarantee you satisfaction as this is a user supported forum. The is no SLA for community support. Perhaps if you posted a better worded question as a new topic someone might be able to help you resolve your issue.
The topic you are posting on is closed and answered.
¯\_(ツ)_/¯ -
Hi,
How to know whether the Content Type at Library level is Inheriting Parent Content type or not using Powershell?
Is there any property for that? Or Do I need to compare the Content type Id's at Site collection level and Library level?
Any help would be greatly appreciated.
Thank you,
AA.Hi Ashok,
For a content type, there is an attribute called Inherits, the value of this attribute determines whether the content type inherits fields from its parent content type when it is created.
If Inherits is TRUE, the child content type inherits all fields that are in the parent, including fields that users have added.
If Inherits is FALSE or absent and the parent content type is a built-in type, the child content type inherits only the fields that were in the parent content type when SharePoint Foundation was
installed. The child content type does not have any fields that users have added to the parent content type.
More information, please refer to the link:
https://msdn.microsoft.com/en-us/library/office/aa544268.aspx?f=255&MSPPError=-2147217396
Best Regards,
Wendy
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] -
How to add new group entry in Cisco Vpn using powershell
I am working on a powershell script to connect cisco vpn using powershell, I am able to connect to vpn but not sure how to add new group to vpn. I am using the following script$vpn_profile = 'Test'
$username = 'TestUser'
$userPassword = ConvertTo-SecureString -String "Password" -AsPlainText -Force
$credentials = new-object -typename System.Management.Automation.PSCredential -argumentlist
$username,$userPassword
$password = $credentials.GetNetworkCredential().Password
Set-Location 'c:\Program Files (x86)\Cisco Systems\VPN Client'
.\vpnclient.exe connect $vpn_profile user $username pwd $password
Write-Host "You Are Connected"
cd "C:\"Have you entered .\vpnclient.exe /? to see if it will return information about other switches you can use with this executable? Other than connect, I was able to track down a few without actually having the executable (http://www.scribd.com/doc/40108893/Cisco-VPN-Client-Command-Line).
That said, I do not believe that there is a switch that will help you create a connection. These are either done manually through the GUI, or can be likely be added by supplying a properly formatted file in the proper place.
If you're using the version of the Cisco VPN client I think you are, then your connection settings, or profiles, are stored in individual .pcf files somewhere on your computer (likely in the Cisco directory). These are simple, text-based files. Find one
on your computer, save it with another name, and then modify it manually. If you really want to use PowerShell, then use this opportunity to learn how to create and edit basic text files using PowerShell. If you have a standard connection file, then you can
put that file onto remote computers any number of ways. If a .pcf file exists in the proper place when the VPN client is opened, then it likely will not prompt for a new connection.
Update: Added more info; clarified -
Missing-anchor-value Error using PowerShell MA (Soren Granfeldt)
Hi Everyone,
I'm triying to do a simple sinchronization using PowerShel MA (Soren Granfeld) v5.0. I've already configured the MA, but when I do a Full Import the Sync Engine sent me: missing-anchor-value. I configured the anchor attribute based on the blog PowerShel
MA (Soren Granfeld).
Scheema Script
$obj = New-Object -Type PSCustomObject
$obj | Add-Member -Type NoteProperty -Name "Anchor-Id|String" -Value 1
$obj | Add-Member -Type NoteProperty -Name "objectClass|String" -Value "user"
$obj | Add-Member -Type NoteProperty -Name "AccountName|String" -Value "SG"
$obj | Add-Member -Type NoteProperty -Name "FirstName|String" -Value "Soren"
$obj | Add-Member -Type NoteProperty -Name "LastName|String" -Value "Granfeldt"
$obj | Add-Member -Type NoteProperty -Name "DisplayName|String" -Value "Soren Granfeldt"
$obj | Add-Member -Type NoteProperty -Name "Description|String" -Value "Standard User"
$obj
Import Script
$obj = @{}
$Obj.Add("Id", "1")
$obj.Add("LastName","Cas")
$obj.Add("[DN]","2")
$obj.Add("AccountName","rodcas")
$obj.Add("FirstName","Rod")
$obj.Add("DisplayName","Rod Cas")
$obj.Add("Description","IT")
$obj
Anyone can help me please?
Thanks in advance,I think it's because there is no objectclass property on the import object. It's required attribute. The sample on the website may be wrong. Try adding $obj.objectclass = 'user' in the import script
Regards, Soren Granfeldt
blog is at http://blog.goverco.com | facebook https://www.facebook.com/TheIdentityManagementExplorer | twitter at https://twitter.com/#!/MrGranfeldt -
Add shared calendar to another users account using powershell
Hi,
I am trying to add a calendar to another using account using powershell as it will be easier to make a script than logging in to each user and adding the calendar. Has anyone done this before or know how to do it.
ThanksAre you asking about Outlook or about Exchange?
In Exchange you can likely do this via EWS.
Here is how to do this in Access but has to be done under user account:\
http://www.outlookcode.com/threads.aspx?forumid=2&messageid=27088
Under EWS it is similar but can be done by impersonation.
¯\_(ツ)_/¯
Maybe you are looking for
-
Can I see my Macbook Pro's screen on my TV through Apple TV?
Hi, I just recently got a Macbook Pro and have been looking into the Apple TV device. I will be starting school soon, so I would like to use it just for Netflix but I also would like to mirror what is on my laptop onto it (so that I can use my Macboo
-
Firefox won't open my Google calendar but Internet Explorer will. How can I fix this?
This is the screen I get from Firefox - I have tried after saving, changing and deleting cookies: The page isn't redirecting properly Firefox has detected that the server is redirecting the request for this address in a way that will never complete.
-
Image is not exporting to PDF correctly
When I export my document, everything exports fine except one image. It has been doing this with multiple images, as I've changed the image a couple of times to make sure that the image wasn't corrupted. Why would it be doing this? How document sho
-
Application not detected in Task Sequence
Hello, I have problems with some applications in a task sequence with SCCM2012 R2. The applications install fine in a normal deployment via Software Center and get detected after the Installation. The same applications get installed in a TS but are n
-
Hello all i'm working on a homework assignment in where we created a match game. It's up to me to figure out how to tell the action script which difficulty the user play the game at. There are 3 buttons easy, mediym, hard. Each one lays out an inc