How do I delete a sharepoint group that has arabic characters in the title? - moss

I have a sharepoint group that has arabic characters in the title. The site has been deleted, and I need to remove the group. When I use the GUI, I get this error message:
Error Code: 500 Internal Server Error. The server denied the specified Uniform Resource Locator (URL). Contact the server administrator. (12202)
When I use stsadm -o enumgroups I get this as the group name:
<Name>Blah blah -- ????? ??????? ????????? Members</Name>
stsadm -o deletegroup -name "Blah blah -- ????? ??????? ????????? Members" -url http://myurl.com returns:
Group cannot be found.
I know the group ID, any way I can use that in my quest for deletion?

Remember that deletegroup requires the site URL as well. In this case I think you'll have to use the OM - you can use the SPGroupCollection.RemoveByID() method to do so.

I would use a console application to explore the group, (see if there is any information within it that you need to keep) and then delete it.

Related

Powershell: validate URL path, incorrect path vs non public path

I am trying to validate a URL that, if valid, I will use to download a file. But I want to validate the domain and the full path BEFORE doing the download, so I can provide a meaningful error log.
Given paths like the following
www.validDomain.com/downloads/validDownload.zip
www.validDomain.com/downloads/invalidDownload.zip
www.invalidDomain.com/downloads/validDownload.zip
I want to be able to report
invalid path: /downloads/invalidDownload.zip
Invalid domain: www.validDomain.com
I can use
$uri = [System.Uri]$path
if (Resolve-DnsName -Name:$uri.host) {}
to test the domain. I can then use
if (Invoke-Webrequest $uri.OriginalString -DisableKeepAlive -UseBasicParsing -Method:head) {}
to test the full path without actually doing the download, but the only error I get is The remote server returned an error: (403) Forbidden., both when the path doesn't exist and when the path does exist but it isn't a publicly available path.
Is there any way, on the PowerShell side, to differentiate the permissions issue vs the incorrect path issue?
Or do I have no choice but to provide a wishy washy error in the log? I know effetely the path does not exist to the user who doesn't have permissions, I am just hoping there is some client side way to differentiate. But I may be running into the limitations of how the web has been implemented.

Getting non-common attributes from AD B2C users with PowerShell

I would like to retrieve the following attributes: "createdDateTime, extension_xxxxxx_yyyyy, identities" from AD B2C users. With Graph Explorer, I could do this with:
https://graph.microsoft.com/v1.0/users?$select=createdDateTime extension_xxxxxx_yyyyy, identities
Then, I tried the snippet generated by Graph Explorer for PowerShell
Get-MgUser -Property “createdDateTime,+ extension_xxxxxx_yyyyy,identities”
I got the following error:
Parsing OData Select and Expand failed: Syntax error: character '+' is
not valid at position 17 in 'createdDateTime, +exten ……
I removed the “+” and retried, it had no error, but all the returned fields were blank.
I am using Microsoft Graph PowerShell SDK 1.18
It is easier to use the beta version of the API
Select-MgProfile -Name "beta"
CreatedDateTime can be got directly
Identities can be got directly but it is an array
extension_xxxxxx_yyyyy is the trickiest, it is packed inside the AdditionalProperties

How can I get the Subscription Name if i know the resource Group Name using Powershell

So, I have the resource Group name and i want to programmatically (using powershell) set the subscription to the incoming resource group.
When i do a Get-AzResourceGroup I get the ResourceId which contains the the subscription id as part of a long string /subscriptions/<subscription id here>/resourceGroups/resourcegroupname. Is there a way to extract the subscription Id from that string?
You can get your subscription ID by triggering the below. You will also need to have azure cli installed.
az account list --refresh --query "[?contains(name, 'YOUR_SUBSCRIPTION')].id"
You can also split the output from powershell.
$myinput= "/subscriptions/xxxxxx-xxxxxx-xxxxxx-xxxxx-xxxxxx/resourceGroups/resourcegroupname".Split("/")
Write-Host $myinput[2]

Assign ITGlue Contact to the Field using API powershell

I just want to assign the contacts to Application's field and another field with API Powershell but I don't know how to do it. could anyone help me?
According to their API documentation, there is no 'Application' resource type. Is it a custom resource, or a field on a different type of object? (what type?)
Try installing ITGlue's PowerShell wrapper module ITGlueAPI from the gallery (or github link):
Install-Module ITGlueAPI
Import-Module ITGlueAPI
# Check out all the available commands
Get-Command -Module ITGlueAPI
# initial setup:
Add-ITGlueBaseURI -base_uri 'http://myapi.gateway.example.com'
Add-ITGlueAPIKey -ApiKey 'your-key-here'
# Play around with these kinds of "Get-" commands which exist for each resource type:
# This is a good way to see how the data is formatted, and which fields exist per resource
Get-ITGlueFlexibleAssets
Get-ITGlueContacts -organization_id 1234 -filter_first_name 'Foo' -sort 'first_name'
# To make changes, run similar "Set-" or "New-" commands with the updates in hash table format:
Set-ITGlueContacts -id 1234 -data #{
location-id = 795
location-name = "San Francisco - HQ"
field-name = "Value"
}

How to export IBM Watson conversation history?

Before running the code, install ibm-watson &
ibm-cloud-sdk-core package and also pip instll PyJWT==1.7.1.
I found in IBM document that "For a Python script you can run to export logs and convert them to CSV format, download the export_logs_py.py file from the Watson Assistant GitHub) repository."
But I don't really know where & how should I modify in order to connect my ibm skill.
There is no demo or instruction about where I can find those argument.
I only find these information in skill api details but it seems it needs more.
Do anyone have an example version about how to use the .py they provided?
(I'm a coding beginner, not really understand every lines in the .py)
The .py shows an error after I run the file without modification:
runfile('C:/export_logs.py', wdir='C:/Users/admin/Downloads')
usage: export_logs.py [-h] [--logtype {ASSISTANT,WORKSPACE,DEPLOYMENT}]
[--language LANGUAGE] [--filetype {CSV,TSV,XLSX,JSON}]
[--url URL] [--version VERSION]
[--totalpages TOTALPAGES] [--pagelimit PAGELIMIT]
[--filter FILTER] [--strip STRIP]
apikey id filename
export_logs.py: error: the following arguments are required: apikey, id, filename
An exception has occurred, use %tb to see the full traceback.
SystemExit: 2
The conversation I want to download:
First of all, Workspaces in IBM Watson Assistant are now called Skills.
To understand what arguments(positional and optional) you need to pass to the Python script, run the below command
python export_logs_py.py -h
Wherever you see workspace, you can replace it with skill.
To export the logs in the .csv file format, run the below command
python export_logs_py.py --filetype CSV --url <URL> <API_KEY> <SKILL_ID> output.csv
Replace placeholders <URL, <API_KEY> and <SKILL_ID> with appropriate values mentioned below.
<URL> & <API_KEY> - You can find them under the Manage page of your Watson Assistant service page
<SKILL_ID> - The same as the one in the image you uploaded. Check this StackOverflow answer for more info.
For Assistant logs, add --logtype ASSISTANT. The default is WORKSPACE.
You can also find the logs in the UI under Analytics section of your Skill
As you can see, the script reported an error and said that you have to provide the apikey, the id and the (presumably output) filename as parameters. It also showed that additional parameters can be specified.
usage: export_logs.py [-h] [--logtype {ASSISTANT,WORKSPACE,DEPLOYMENT}]
[--language LANGUAGE] [--filetype {CSV,TSV,XLSX,JSON}]
[--url URL] [--version VERSION]
[--totalpages TOTALPAGES] [--pagelimit PAGELIMIT]
[--filter FILTER] [--strip STRIP]
apikey id filename
Your next step could be now to invoke the script again, but provide an API key for Watson Assistant, the skill ID and a filename as additional paramaters. Next, I would try to something like, e.g., trying out to specify the output type:
export_logs.py --filetype CSV myapikey skillID output.csv
I am not the author of that script, but that is how I would approach it if I wanted to use it