w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML Categories
running a bat file and powershell with elevated priviliges
I don't know if this is possible to do from outside Power Shell but it can be done from inside. It's hacky but you could run a power shell script from your bat file that then launches the admin Power Shell session using "PS> Start-Process powershell -Verb runAs". PowerShell: Running a command as Administrator

Categories : Powershell

Powershell - script is invoked by 3rd party, how to hard-code elevated credentials
can't you use the start-process CmdLet : start-process 'c:system32WindowsPowerShellv1.0powershell.exe' -verb runas -argumentlist "-file toto.ps1" toto.ps1 will run in an elevated mode.

Categories : Powershell

Running powershell via Start-Proces with elevated credentials hangs for several minutes on Win7 64bit when on network
Well, this is not a PowerShell issue. It is to do with home directory access. Can you try this registry change? Add a REG_DWORD value named StartRunNoHOMEPATH in the following registry key: HKEY_CURRENT_USERSoftwareMicrosoftWindowsCurrentVersionPoliciesExplorer

Categories : Powershell

Powershell - Remove Domain.com/OU/ from Domain.com/OU/GivenName Surname
You can use the Split-Path cmdlet to get the name only: Split-Path 'Domain.com/OU/GivenName Surname' -Leaf I would also try to get the name by checking if Identity has a Name property: $obj.Identity.Name

Categories : Powershell

Is it possible to define priviledge method outside of the constructor?
The very idea behind the scoping in javascript is that this shouldn't be possible, what I would advice is adding a function getPrivate within the scope of the constructor and use that to access 'private' variables. function Keeper(get) { var semiPrivates = { secretPower:'Wisdom' } this.getPrivate = function (variable){ return semiPrivates[variable]; } this.get = get ? get : function () { return 'Its secret power is: ' + semiPrivates["secretPower"]; } }

Categories : Javascript

powershell add user to the domain
Check out this blog, it should help you out http://blogs.technet.com/b/benp/archive/2007/03/05/benp-s-basic-guide-to-managing-active-directory-objects-with-powershell.aspx

Categories : Powershell

getting 404 error on admin panel for sub-directory multisite on a sub-domain in wordpress
there is no .htaccess file in the IIS server, I have a web.config file that is generated by wordpress itself at the time on installation of multisite. web.config generated by wordpress <?xml version="1.0" encoding="UTF-8"?> <configuration> <system.webServer> <rewrite> <rules> <rule name="WordPress Rule 1" stopProcessing="true"> <match url="^index.php$" ignoreCase="false" /> <action type="None" /> </rule> <rule name="WordPress Rule 2" stopProcessing="true"> <match url="^([_0-9a-zA-Z-]+/)?wp-admin$" ignoreCase="false" /> <action type="Redirect" url="{R:1}wp-admin/" redirec

Categories : Wordpress

How to find if a list of computers on are a domain using Powershell?
You can use the code with -Computername parameter and provide explicit credentials in case the remote computer administrator credentials are different from what you are using. $cred = Get-Credential $servers = Get-Content C:scriptsServers.txt Foreach ($server in $servers) { if ((gwmi win32_computersystem -computername $server -Credential $cred).partofdomain -eq $true) { #Do something Here } else { #Do something Here }

Categories : List

Ldap filter to search for users in a given domain (using powershell)
I think the following filter should work: (&(objectCategory=person)(objectClass=user)(dc:dn:=mytestlab)(dc:dn:=com)) The filter above is called an extensible match search because it specifies an attribute name: dc and the DN’s attributes should be considered as part of the entry.

Categories : Powershell

Get name/version number WMI/Powershell query (eventually for all machines on domain)
Check out the examples for Where-Object. They show how to filter properly. Also, Get-WmiObject can be painfully slow. Better to add the filter using its Query or Filter parameters. Again, read the help topic for some examples.

Categories : Powershell

How do I grant SeBatchLogon privileges to a domain account on a Windows server with Powershell?
Use ntrights.exe from the Windows Server 2003 Resource Kit Tools: ntrights +r SeBatchLogon -u mydomainatchuser

Categories : Powershell

forced https on subdomain .htaccess file is sending wordpress admin page to parent domain
Place the following in the .htaccess for the domain # .htaccess WildCard SSL + wordpress + subdomain RewriteEngine on RewriteCond %{HTTP_HOST} ^shop.domain.com$ RewriteCond %{REQUEST_URI} !^/shop/ RewriteRule ^(.*)$ /shop/$1 RewriteCond %{HTTP_HOST} ^shop.domain.com$ RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(/)?$ shop/index.php [L] # BEGIN WordPress for main domain <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteCond %{HTTP_HOST} ^(www.)?domain.com$ RewriteRule ^index.php$ - [L] RewriteCond %{HTTP_HOST} ^(www.)?domain.com$ RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] </IfModule> # END WordPress

Categories : Wordpress

Flask-Admin & Authentication: "/admin" is protected but "/admin/anything-else" is not
If you go to flask_superadmin/base.py, at line 193 there is the following code snippet: def _handle_view(self, name, *args, **kwargs): if not self.is_accessible(): return abort(403) So maybe this method has to be overriden by AdminIndex to avoid returning abort(403) but to redirect to /login

Categories : Python

Why won't CloudFormation execute my command?
Your commands block should be nested inside the config block, at the moment it is at the same level in the hierarchy. "AWS::CloudFormation::Init" : { "config" : { "files" : { "c:\Packages\WebDeploy_amd64_en-US.msi" : { "source" : "http://download.microsoft.com/download/1/B/3/1B3F8377-CFE1-4B40-8402-AE1FC6A0A8C3/WebDeploy_amd64_en-US.msi" } }, "commands" : { "1-installwebdeploy" : { "command" : "msiexec.exe /i c:\Packages\WebDeploy_amd64_en-US.msi ADDLOCAL=ALL /qn /norestart" } } }, }

Categories : Amazon

How does the UAC know the application is going to need elevated privileges?
How does UAC know the application is going to write to ProgramData ProgramData MIGHT be under the list of "Protected Directories" during the virtualization process of the UAC Architecture. (source needed) What can I change so that the UAC does not complain? Couple options here - It appears that you are trying to write to C:ProgramData[Company][Product] To me, this looks like a path separation issue. you are trying to create [or use] a directory named C:ProgramDataAdobePhotoshop if your application is not seperating these directories, then i'd assume that this is causing your UAC issue. try adding your path seperators. C:ProgramDataAdobePhotoshop [as an example] Disable UAC? The UAC is there to prevent unauthorized activity, and if you look at the flowchart above, any application

Categories : C#

.htaccess domain directory does not resolve domain.com/domain properly
Replace your code with this code: Options +FollowSymLinks -MultiViews # Turn mod_rewrite on RewriteEngine On RewriteBase / RewriteCond %{DOCUMENT_ROOT}/$1 !-f RewriteCond %{DOCUMENT_ROOT}/$1 !-d RewriteCond %{HTTP_HOST} ^(www.)?bar.com$ [NC] RewriteCond %{THE_REQUEST} ^[A-Z]{3,}s/+bar[?/s] [NC] RewriteRule ^(.*)$ - [L,R=404] RewriteCond %{HTTP_HOST} ^(www.)?bar.com$ [NC] RewriteCond %{ENV:REDIRECT_STATUS} !200 RewriteRule ^bar(/.*|)$ /bar/bar$1 [L] RewriteCond %{HTTP_HOST} ^(www.)?bar.com$ [NC] RewriteCond %{ENV:REDIRECT_STATUS} !200 RewriteRule ^(.*)$ /bar/$1 [L]

Categories : Apache

AWS - Automatic deployment (.NET) to CloudFormation stack
cloud-init is used with windows too. See the documentation for bootstrapping Windows stacks.

Categories : Amazon

Why won't my CloudFormation script download a file?
Jonathon, I tried your template and the file downloaded successfully for me. You can check the cfn logs on the instance. They are in c:cfnlog. My cfn-init.log shows: 2013-07-19 21:30:18,269 [DEBUG] Parent directory c: est does not exist, creating 2013-07-19 21:30:18,269 [DEBUG] Writing content to c: estgoogle-logo.png 2013-07-19 21:30:18,269 [DEBUG] Retrieving contents from http://www.google.com/images/srpr/logo4w.png 2013-07-19 21:30:18,316 [DEBUG] No mode specified for c: estgoogle-logo.png 2013-07-19 21:30:18,316 [WARNING] Unsupported OS for setting owner/group: nt And my cfn-wire.log shows: 2013-07-19 21:30:18,269 [DEBUG] Request: GET http://www.google.com/images/srpr/logo4w.png [headers: {'Accept-Encoding': 'identity, deflate, compress, gzip', 'Accept': '*/*', 'User-Agent': 'pyth

Categories : Amazon

Detect if JScript is running elevated?
OK. I think I got it. Thanks to this poster, this seems to work: function isRunningElevated() { //Checks if this scrpt is running elevated //RETURN: // = 'true' if yes var res = runCommandNoWindow("net session"); return res === 0; } function runCommandNoWindow(strCmd) { //Run command //RETURN: // = Integer returned by the command var res = null; try { var oShell = WScript.CreateObject("WScript.Shell"); res = oShell.Run(strCmd, 0, true); //No window, wait to finish! } catch(e) { //Failed res = null; } return res; }

Categories : Javascript

Run with elevated rights fails on WIN7
Most likely explanation is that this is a 32 bit vs 64 bit issue. The DLL is 64 bit, and you are running the 32 bit regsvr32. Or vice versa. Or the file system redirector is confounding you. You put the DLL in system32, but the redirector turns that into SysWow64. The obvious way to debug it is to remove the silent switch and let regsvr32 tell you what went wrong. As an aside, as you have discovered, you cannot use the return value of ShellExecuteEx to determine whether or not the server registration succeeded. The return value of ShellExecuteEx merely tells you whether or not the process started.

Categories : Delphi

Running Multiple Elevated Cmd Prompts through C#
I don't see where you send the command to the process after you start it, try redirecting StandardInput then sending strCmdTxt, see this article for a sample on using StandardInput Though I do not understand why you are trying to use a process to start a cmd prompt to copy the files, why don't you just do the file copy directly from C# using good old File.Copy, just start up your app as admin/elevated

Categories : C#

Is it possible to create a SNS subscription with CloudFormation without creating a topic?
As you already discovered, AWS CloudFormation doesn't provide the expected AWS::SNS::Subscription resource (yet) and I'm not aware of this being possible by any other means, unfortunately - guess the rationale is that both are either managed within a template or externally, but your use case is sound and I can see no fundamental reason why this shouldn't be available (maybe they'll add it at some point, AWS is usually expanding their APIs over time to address such inconsistencies/missings).

Categories : Amazon

Installing Windows applications/extensions with Amazon CloudFormation
For your example of WebDeploy, you could add this: "C:\Webdeploy\WebDeploy_amd64_en-US.msi" : { "source" : "http://download.microsoft.com/download/1/B/3/1B3F8377-CFE1-4B40-8402-AE1FC6A0A8C3/WebDeploy_amd64_en-US.msi" } as a element of this section of the template "WindowsServer": { "Type" : "AWS::EC2::Instance", "Metadata" : { "AWS::CloudFormation::Init" : { "config" : { "files" : { You could then add this command: "1-installwebdeploy" : { "command" : "msiexec.exe /i C:\Webdeploy\WebDeploy_amd64_en-US.msi ADDLOCAL=ALL /qn /norestart" } to the list of commands.

Categories : Amazon

Out-file elevated Credentials Error: The Device is not Ready
If you want to centralize logging, use Write-EventLog and collect the events via event forwarding.

Categories : Powershell

convert java domain model from domain A to domain B
You may want to look at DOZER. The lib will allow wildcard transformation of fields (if they share the same name) and also permit custom converter.

Categories : Java

Generating subnet CIDR blocks programmatically in CloudFormation templates (or adding integers together)
My solution for these kinds of issues was to use a legitimate programming language to compile a template into a CloudFormation JSON document. I used PHP 5.4, Twig and Symfony Console, but YMMV. Essentially, you do the math ahead of time in the programming language, then use that data as you write-out your JSON document.

Categories : Amazon

We would like to hide Admin link if user that logged in is not an admin. Any ideas why my code isn't working?
The variable may have to be cast to an int as the comparison could be of an object or string to the integer 1 which isn't likely the intended comparison. IOW: "1" = 1 Is likely going to be false.

Categories : Asp Net

How to start a program requiring admin rights as an admin user from a nonadmin account
I guess you're referring to is to trigger an UAC prompt on the newly created process. If so, just a few lines will do the trick, specifically removing the user/pass properties (since they'll be asked by Windows) and setting UseShellExecute to true: ProcessStartInfo myProcess = new ProcessStartInfo(path); myProcess.WorkingDirectory = @"C:WindowsSystem32"; myProcess.UseShellExecute = true; myProcess.Verb = "runas"; Process.Start(myProcess); Two caveats I've noticed with this approach is that, if the user cancels the prompt, an exception will be thrown saying that the user has cancelled (which you must be ready to cancel your processing). Also, if UAC is disabled/not present on the system, the process will NOT be elevated. To counter that, the launched program must be ready to check if it

Categories : C#

Is active Admin a good fit for a complex admin interface for a daily deal rails 3.2 app?
any answer for this question will be subjective.. formally, you can override anything (views, models, controllers) in activeadmin very easily. all this cases have minimal but enough instructions in documentation there are some difficulties to override look&feel for example with bootstrap to receive more responsive layouts but in general case AA is administration framework designed for generic backends so this feature is not critical according to your question to manage forms it supports formtastic so you can use any power of this gem you can override form with generic _form.html.erb in one line with form :partial => "form" you can use html-editors like this or this or other (like this) out of the box BUT this moment always insensibly comes when you begin to understand that so

Categories : Ruby On Rails

How to redirect user to 404 page not found error when non admin try to access wp-admin or wp-login.php
I assume that you're trying to protect yourself from brute-force attacks? Why not just limit the frequency of allowed login attempts? There is a pretty solid plugin called "Limit Login Attempts" which will track per IP and the use of cookies. Check it out here: http://wordpress.org/plugins/limit-login-attempts/ Trying to mask the login page is an interesting idea, though. You could just create your own login page somewhere and have it interact with a custom login script that you write. This would allow you 301 redirect the login pages to a 404 page without messing with any core functionality. You could have a form at something like https://yourwpsite.com/supersecretlogin and then have it POST to a custom handler that uses the wp_signon method. Here's an example of how to log someone in

Categories : Wordpress

How to create two admin view and seperating the model between 2 admin views by using rails_admin gem
You cant achieve that using rails_admin. I've tried couple of months ago and found its not made for that. Currently I am using rails_admin for SuperAdmin as its required less customization. And I am using active_admin for normal administration.

Categories : Ruby On Rails

Show admin panel button only if user is logged in and is in admin role
But how should I implement such a helper? By writing an extension method to the HtmlHelper class: public static class HtmlExtensions { public static IHtmlString MyCustomHelperWhichShowButton(this HtmlHelper html, string text) { var isAuthnticated = html.ViewContext.HttpContext.User.Identity.IsAuthenticated; if (isAuthnticated) { return html.ActionLink(text, "MyListings", "List"); } return new HtmlString(string.Empty); } } and by adding the namespace in which you defined this class to the <namespaces> section of your ~/Views/web.config file which will bring this helper into scope in all your views.

Categories : C#

Pointing domain at seperate sub-domain & domain
This comes down to the provider's definition of "web forwarding", which is a vague marketing term. It sounds like they're just doing a straight redirection unfortunately, which no amount of playing with .htaccess files can fix: you simply cannot make a website tell the browser to stick another domain name in its address bar. What I'd suggest is talking to them and see if they can do a CNAME for www.domain1.com to subdomain.domain2.com, or switch to it using the same IP address instead. You will then need to set up your Wordpress install to respond to "www.domain1.com" requests.

Categories : Wordpress

Handling admin rights in mixed user/admin windows app
I don't know if it's the best way (no-one answered) but I did that now :) The bootstrapper has just requireAdministrator in the Manifest and does a ShellExecute to the main executeable with switch "/Activate" ...

Categories : Windows

How to find which admin logged in django admin site?
Using formfield for choice field One can do this def formfield_for_choice_field(self, db_field, request, **kwargs): if db_field.name == "user_type": kwargs['choices'] = ( (1, 'ADMIN'), (0, 'USER'), ) if request.user.is_superuser: kwargs['choices'] += ((2, 'SUPER ADMIN'),) return super(UserProfileAdmin, self).formfield_for_choice_field(db_field, request, **kwargs)

Categories : Django

Cannot Modify Registry (or run admin level commands) in C# as Admin
I found the solution to this after a lot of research. I used the example provided from this post on codeproject: http://www.codeproject.com/Articles/7665/Extend-ServiceController-class-to-change-the-Start After setting it up and changing it to how I needed, everything worked fine for all Windows Operating Systems (XP and newer at least).

Categories : C#

Active Admin uninitialized constant Admin::DashboardController
I found several issues: assets generator must best execute after an update; controllers/admin clashes with ActiveAdmin route; root directive should be define before ActiveAdmin route. To fix number one: $> rails generate active_admin:assets To fix number two: config.default_namespace = :your_desired_namespace To fix number three just move root up (in config/routes.rb)

Categories : Misc

How to set flash message in sonata admin Admin Controller
You are talking about an admin class, not a controller. And this is not possible by default. Best way to do this is to write a custom CRUDController (extend from default one) and handle it there.

Categories : PHP

Admin redirect to domine.com/admin from domine.com/app/admin after login
when you are using url always put / at begining and end. for eg:- <a href="/<url>/">testing</a> or in Httpresponse as HttpResponseRedirect('/<url>/')

Categories : Python

how to construct a string of physical subnet ids to create db subnet group on the fly in a cloudformation script?
I run into the same issue, after working with AWS support I understood that List of String does not mean what we initially thought. Also, if you want to place the DB inside a VPC you must not use AWS::RDS::DBSecurityGroup objects. Here is a full sample, it took me a while to get it working: "dbSubnetGroup" : { "Type" : "AWS::RDS::DBSubnetGroup", "Properties" : { "DBSubnetGroupDescription" : "Availability Zones for RDS DB", "SubnetIds" : [ { "Ref" : "subnetPrivate1" }, { "Ref" : "subnetPrivate2" } ] } }, "dbInstance" : { "Type" : "AWS::RDS::DBInstance", "Properties" : { "DBInstanceIdentifier" : { "Fn::Join" : [ "", [ { "Ref" : "AWS::St

Categories : Amazon



© Copyright 2017 w3hello.com Publishing Limited. All rights reserved.