Jump to content
Sign in to follow this  
faustf

permission in script for runwait

Recommended Posts

faustf

hi guys i try to run a  script powershel.ps1   by  runwait   , but   the  answer of  script is  insufficient permition for perform action, 

but in my script i  insert require admin , why not  work???

#AutoIt3Wrapper_Compression=3
#AutoIt3Wrapper_UseUpx=y
#AutoIt3Wrapper_Res_requestedExecutionLevel=requireAdministrator
#AutoIt3Wrapper_Add_Constants=n
#AutoIt3Wrapper_AU3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 -w 7
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****

#include <Array.au3>
#include <MsgBoxConstants.au3>
#include <WindowsConstants.au3>
#include <WinAPIFiles.au3>
#include <File.au3>
#include <Date.au3>
#include <FileConstants.au3>
#include <Process.au3>


_ShadowCopyON()


Func _ShadowCopyON()
    Local $iFileExists = FileExists(@SystemDir & "\WindowsPowerShell")

    If $iFileExists Then

        ;Runwait('powershell.exe (Get-WmiObject -list win32_shadowcopy).Create("C:\","ClientAccessible") > c:\temp\ps_create.txt', '', @SW_HIDE)
        ;Runwait(@ComSpec & 'powershell.exe (Get-WmiObject -list win32_shadowcopy).Create("C:\","ClientAccessible") > c:\temp\ps_create.txt', '')
    RunWait(@ComSpec & ' /k powershell.exe -executionpolicy remotesigned  -File ShadowCopyAttach.ps1')
    ;   RunAs("SviluppoGest","workgroup","galleggiare",0,@ComSpec & ' /k powershell.exe -executionpolicy remotesigned  -File ShadowCopyAttach.ps1')


    Else
        MsgBox($MB_SYSTEMMODAL, "", "Windows Powershell non esiste devi scaricarlo" & @CRLF & "FileExist returned: " & $iFileExists)
        ShellExecute("https://www.microsoft.com/it-IT/download/confirmation.aspx?id=16818") ; powershell download for windows xp
    EndIf






EndFunc   ;==>_ShadowCopyON

content of  ps1 is

# (c) Copyright 2014,2015 Hewlett-Packard Development Company, L.P.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#    http://www.apache.org/licenses/LICENSE-2.0

# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

param([String]$volume="")

$shadow = get-wmiobject win32_shadowcopy

# get static method
$class=[WMICLASS]"root\cimv2:win32_shadowcopy"

# create a new shadow copy
$s1 = $class.create($volume, "ClientAccessible")

# get shadow ID
$s2 = gwmi Win32_ShadowCopy | ? { $_.ID -eq $s1.ShadowID }

$d  = $s2.DeviceObject + "\"

# create a symlink for the shadow path
cmd /c mklink /d $volume\freezer_shadowcopy "$d"

echo "shadow id:" $s2

some one can help me??

thankz at all

 

Share this post


Link to post
Share on other sites
BrewManNH

Are you compiling the script? Because if you don't, the wrapper directive doesn't get acted upon.

Also, to prevent anti-virus problems, don't use UPX.


If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites
faustf

no  i dont  compile for the moment , i try with  compile , thankz

 

Share this post


Link to post
Share on other sites
faustf

other questions, i compiled it  , but  when i run it , popup UAC and ask mi if i want run administrator  , is possible dont  ask this questions ???, because  the script  will must backup in background

thankz

 

Share this post


Link to post
Share on other sites
BrewManNH
2 minutes ago, faustf said:

is possible dont  ask this questions

No, not if you want to run it as an admin, it has to ask if it's ok to run.


If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites
faustf

and not exist a solution ?? if i create a backup script is not possible run without interact ? :(((

 

Share this post


Link to post
Share on other sites
orbs

do what all backup applications do - launch by a scheduled task, running under the local SYSTEM account.

Share this post


Link to post
Share on other sites
faustf

you  have  an example???

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×