how to add user in COM security for access permission and launch and activation permission using powershell - powershell

I have a task to do the following:
Change machine wide config
Open the DCOM configuration tool e.g. by running "dcomcnfg" from start menu
Open the machine wide configuration by right-clicking "My Computer":
Go to the "COM Security" tab.
Edit Limits and Edit Default for all both "Access Permission" and "Launch and Activation Permissions". Add users:
"everyone", "Anonymous logon", "system", "network", "network service", "interactive" and "test"
With some permissions (Same for all users above):
First I want to add "test" user.
I know how to do manually but I want to do using power shell.
Need your kind support
Thanks

Related

Firebase Storage Access to fetch at '..' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource

For debugging purposes, I'm using the 'CORS Unblock' extension on chrome and I'm able to load without any CORS issues.
To resolve this
Go to https://console.cloud.google.com and select the dashboard of the project that contains the firebase storage bucket.
On the top right, there will be a button named "Activate Cloud Shell", click on it, a terminal will open on the bottom of the page, and near the middle of the page there will be a button called "Open editor", click on it. From there you should see this:
Click on File, on the menu on top. New file. Call it cors.json, paste the following (from Firebase's documentation) and hit save.
[
{
"origin": ["*"],
"method": ["GET"],
"maxAgeSeconds": 3600
}
]
Go to https://console.firebase.google.com/ and select "Storage" from the menu on the left, get your storage bucket url (it starts with gs://)
Then open the terminal again (Activate Shell Command) and paste
gsutil cors set cors.json gs://<your-cloud-storage-bucket>
In theory the error should be completely gone for that specified bucket.
Note, this would only apply to the storage bucket you entered, you can have CORS policies per project, as you can have multiple buckets per project. It's intuitive and flexible.

VSTS release errors on "IIS Web App Manage" step with AppCmd "Not enough storage is available to process this command."

Have a simple two-step release definition in Visual Studio Team Services / VSTS based on the "IIS Website Deployment" template set to configure an application pool (v4, integrated, application pool identity) and website (http, 192.168.0.xxx LAN IP, port 80, valid hostname) which is throwing an error I've struggled to find any details on. Isolated the issue to some AppCmd parameters but can't seem to remove them via the step settings.
Deploying out to a 2008 R2 target via VSTS agent v2.127.0 which installed without any issues but AppCmd consistently fails on the "IIS Web App Manage" step (after reconfiguring the application pool, creating a directory etc. without problems) then exits with code 8
hresult 80070008, Failed to commit configuration changes. Not enough storage is available to process this command.
Full log below but this line causes the error
"C:\Windows\system32\inetsrv\appcmd.exe" set site /site.name:"Example - Website Name" -applicationDefaults.applicationPool:"Example - AppPool Name" -[path='/'].[path='/'].physicalPath:"D:\Test\Example - Website Name" -[path='/'].[path='/'].userName: -[path='/'].[path='/'].password:
Running this directly on the target produces the same error, if I strip the blank username & password parameters it works. Checked we're not trying to set credentials and combinations of the authentication settings against the website and these two parameters won't either dissappear or format in a way which doesn't throw an error.
Tried searching for similar questions and it's lead nowhere, restarted the target in case it was a memory issue, even tried building a website-only step but the error remains.
##[section]Starting: Configure IIS AppPool & Website
==============================================================================
Task : IIS Web App Manage
Description : Create or update a Website, Web App, Virtual Directories, and Application Pool
Version : 0.5.4
Author : Microsoft Corporation
Help : [More Information](https://go.microsoft.com/fwlink/?linkid=839731)
==============================================================================
##[command]"C:\Windows\system32\inetsrv\appcmd.exe" list apppool /name:"Example - AppPool Name"
##[command]"C:\Windows\system32\inetsrv\appcmd.exe" set apppool /apppool.name:"Example - AppPool Name" -managedRuntimeVersion:v4.0 -managedPipelineMode:Integrated -processModel.identityType:ApplicationPoolIdentity
APPPOOL object "Example - AppPool Name" changed
##[command]"C:\Windows\system32\inetsrv\appcmd.exe" list site /name:"Example - Website Name"
##[command]"C:\Windows\system32\inetsrv\appcmd.exe" add site /name:"Example - Website Name" /physicalPath:"D:\Test\Example - Website Name"
SITE object "Example - Website Name" added
APP object "Example - Website Name/" added
VDIR object "Example - Website Name/" added
##[command]"C:\Windows\system32\inetsrv\appcmd.exe" set site /site.name:"Example - Website Name" -applicationDefaults.applicationPool:"Example - AppPool Name" -[path='/'].[path='/'].physicalPath:"D:\Test\Example - Website Name" -[path='/'].[path='/'].userName: -[path='/'].[path='/'].password:
SITE object "Example - Website Name" changed
ERROR ( hresult:80070008, message:Failed to commit configuration changes.
Not enough storage is available to process this command.
)
##[error]Process 'appcmd.exe' exited with code '8'.
##[section]Finishing: Configure IIS AppPool & Website
After discussing with MS Developer Support my problem appeared to be an issue with the target server's applicationHost.config encryption/security keys complicated by a less-than-useful error message being returned by AppCmd
The easiest way to verify the applicationHost.config being at fault was backing up the current config before reverting to an original, default copy of the applicationHost.config (C:\Windows\System32\inetsrv\config) then restarting the W3SVC service - was able to execute the "IIS Web App Manage" step without any issues afterwards.
Unfortunately keeping it reverted wasn't an option, so diffed the two versions of the config and found two keys with different sessionKey values in <configuration><configProtectedData><providers>
Copied the version of the highlighted keys (AesProvider & IISWASOnlyAesProvider) from our clean config to the current, restarted the W3SVC service and the same AppCmd line was able to run successfully.
Will continue to monitor as this was only happening on a physical internal development server with many potential ways the applicationHost.config could have accidentally changed while it's been in service - none of which should ever apply to a production system.

How to use variables in the Application Lab interface to Workload Scheduler on Bluemix

I'm trying to use the Application Lab application on Bluemix's Workload Scheduler service but can't find any documentation on how to use it. Specifically, I need to run a RESTful URL once a day, with a timestamp of the previous run embedded in the URL.
Creating variables in Application Lab seems pretty straightforward, but I can't figure out how to set or use them. Can someone point me in the right direction?
The update of the variables of the application lab via APIs is not yet available (it will be soon).
There is another way of doing it that I can share with you.
Follow these steps:
Enable the cloud agent to run scripts
You should open a ticket for that. By defaults the cloud agent is not enabled to run scripts but you can open a ticket to change this.
Get the user credentials
Open the service a take not of the user credentials. Click "Add credentials" if they are not present.
Open the Workload Editor
The workload editor is a more powerful UI with respect to the Application Lab and enable complex scenarios.
To open the Workload Designer, open the Application Lab, right click on a process and select "Launch Workload Designer".
Define the restful job
Create a new restful job:
Then set the name and the workstations and check the flag "Variable resolution at runtime".
Then click on the "Action" pane and set the URI of the service. Add the ${TIMESTAMP} variable in the URI. For testing purposes I used this URI:
http://echo.jsontest.com/title/ipsum/content/${TIMESTAMP}
Save this definition (use the floppy disk icon).
Define the job that updates the variable
Create an executable job:
Set the name, the workstation and the "Variable resolution at runtime" flag
Then open the "Task pane" and add the following in the script field:
#/bin/sh -x
#Set the following 3 variables from your credentials
export USERNAME="xxxxxx#bluemix.net"
export PASSWORD='xxxxxx'
export HOSTNAME=xxxxx.wa.ibmserviceengage.com
#Replace "CC" with the letters of your tenant
export VT=CCTIMESTAMP
#MAIN STARTS HERE
export TIMESTAMP=`date +%s`
. /home/wauser/TWA/TWS/tws_env.sh
echo "VARTABLE $VT MEMBERS TIMESTAMP \"$TIMESTAMP\" END" > /home/wauser/vt.txt
composer -host $HOSTNAME -protocol https -username "$USERNAME" -password $PASSWORD replace /home/wauser/vt.txt
Save the job.
Submit the job by clicking "Select Action" -> "Submit Job into current plan".
Define a job stream
Click "New" -> "Job Stream"
Define the name, the workstation and the variable table (replace CC with your two letters tenant id).
The right click on and select add jobs:
Add the "TEST" and "UPDATETIMESTAMP" jobs (or the name you used).
Right click on "UPDATETIMESTAMP" and select "Add dependencies" -> "Job in the same job stream" and then select "TEST".
Right click on "Run Cycles" and select "Add Run Cycle"
Open the "Rule" pane and select "Daily"
Open the "Time Restrictions" and set the time when the job stream has to start and check the flag "use as time dependency".
Save the job stream and you're done!

sending email using cdo & classic asp on dedicated server (memset) in IIS6?

Firstly I am new to setting up a server so appologies for being dumb.
I have a website which is hosted on a provider called memset its a 2008r2 box using ms sql 2012. My domain was bought from my 1and1.co.uk account and the dns is pointing to my site - all working fine - site works! However in using cdo to send mail in a classic asp page I am struggling to understand how - what i should do.
I did create some email accounts on 1and1... but am unsure if this is correct or if i should do something different? I have set the site up to use iis7, and installed iis6 / smtp server on 2008r2.
How should i configure iis6? should i send it via my new server i am creating - or forward the emails to 1and1 - and if so how do i do this? is this to do with smart host at all ??
So confused.
I am a web / dba developer by trade - not a server manager.
Running Classic ASP on IIS 7.x Checklist:
(1) Do not name site folders with .com, .net, etc at the end.
(2) Create NEW user account:
- [app pool user identity] is user: app_pool_blahblahblah, pw: xxxxxx
(3) In Server Manager, right click "Web Server (IIS)" and choose "Add Role Services". Add IIS 6 Management Compatibility.
(4) In Server Manager under features add SMTP server.
Install IIS6 Resource Kit so you can
Use Metabase Explorer.
Grant the [app pool user identity] user read access to the /Local Machine/SmtpSvc/ and /Local Machine/SmtpSvc/1/ nodes in the IIS Metabas
(5) In Application Pool, advanced settings:
- set .Net Framework version to "v2.0" <-- fixed issue with default asp doc not working!
- set "Enable 32-bit applications" to TRUE.
- set managed pipeline mode to "Classic". <-- this may not be necessary.
- under Process Model, change Identity to "[app pool user identity]" account we created.
- be sure "load user profile" is set to FALSE.
- be sure "maximum worker processes" is "1".
(6) Mail: In IIS 6 Management Console:
http://intellitect.com/configuring-windows-smtp-server-on-windows-2008-for-relay/
- Under SMTP Virtual Server Properties:
-- "Access" Tab --> Relay: add IPs of this box, including 127.0.0.1
-- "Delivery" Tab --> Advanced: for "fully qualified domain name" put name of box
-- "Delivery" Tab --> Advanced: for "smart host" put "dedrelay.secureserver.net"
-- "Delivery" Tab --> Outbound connections: Make sure limits are set to 100.
-- "Security" Tab --> add "[app pool user identity]" and IIS_IUSRS
(7) In IIS 7.5 under web site:
- Under ASP:
-- ONLY IF PROBLEM: set enable buffering to "false"
-- under limits change max req entity and buffering limit to 1024000000
-- set script language to "vbscript"
-- set "send errors to browser" to true
- Authentication --> edit "Anonymous Authentication" and set to app pool identity.
- ONLY IF PROBLEM: under error pages: under 404 set to "/home.asp" and "execute URL"
- ONLY IF PROBLEM: edit c:\windows\system32\inetsrv\config\applicationHost.config: change to "Allow"
- under Management (at bottom) go into "Configuration Editor".
-- In the dropdown go to System.web --> http runtime and change maxRequestLength to 1024000000
-- In the dropdown go to System.webserver/security/requestFiltering --> chg allowDoubleEscaping=true
(8)
Set "Modify" Permissions for [app pool user identity] for the following folders:
- your web site
- windows\temp
- inetpub\temp
- inetpub\mailroot
- ONLY IF PROBLEM: windows\serviceprofiles\networkservice\AppData\Local\Temp?
AND Set Permissions in registry:
- ONLY IF PROBLEM: HKLM\SOFTWARE\Wow6432Node\Microsoft\Jet\4.0\Engines?
FOR THESE USER ACCOUNTS:
- IIS_IUSRS
- [app pool user identity]
- NETWORK SERVICE
(9) Install and Use Process Monitor to find permissions issues - filter
(10) Make sure SSL v2 is not being used:
Click Start, click Run, type regedit, and then click OK.
In Registry Editor, locate the following registry key/folder:
HKey_Local_Machine\System\CurrentControlSet\Control\SecurityProviders
\SCHANNEL\Protocols\SSL 2.0
Right-click on the SSL 2.0 folder and select New and then click Key. Name the new folder Server.
Inside the Server folder, click the Edit menu, select New, and click DWORD (32-bit) Value.
Enter Enabled as the name and hit Enter.
Ensure that it shows 0x00000000 (0) under the Data column (it should by default). If it doesn't, right-click and select Modify and enter 0 as the Value data.
Restart the computer.
Verify that no SSL 2.0 ciphers are available at ServerSniff.net or the Public SSL Server Database
(11) SSL issue where Safari tells client that it needs a certificate.
- Go into IIS settings for the SSL-protected site.
- Click on "SSL Settings"
- Choose "ignore".
If you need to send emails, I found that using the Mandrill Email API worked for me (mandrill.com). I am using Classic ASP and was having issues on my web host to do with exceeding the monthly limit for emails sent using their mail servers.
I had to learn a bit about how to use JSON and Classic ASP but it was worth the time.
If you need any example code for how to do it, let me know, would be happy to help.
At least if you do that it'll save you a lot of server config and setup work.

Install4j duplicate shortcut on desktop

When installing an application (packed with install4j) onto a computer that already
has it installed with admin and then with other user rights,
the installer will produce another icon on the desktop
resulting in 2 or more application icons.
To reproduce this:
Install the application as an admin user on windows
Log into another user account that is not an admin.
(A normal user account)
Install application once again, and after the client is finished installing it will produce another icon on the desktop
How can I avoid this behavior?
There are two different desktop folders involved, the public one and the user specific one. If the "Create for all users" property of the "Add a desktop link" action is selected, the action will try to create the link in the public folder, but that usually requires admin privileges. If you don't have admin privileges, you could check if such a file already exists in the public folder. The condition expression of the action could be set to something like:
if (!Util.hasFullAdminRights()) {
File publicLink = new File(WinFileSystem.getSpecialFolder(
SpecialFolder.DESKTOP, true), "launcher name.lnk");
return !publicLink.exists();
} else {
return true;
}